[Geany-Devel] Spawn module API

Lex Trotman elextr at xxxxx
Thu Jun 25 22:47:49 UTC 2015


Hi Dimitar,

I'm now totally confused, so let me ask the important question directly:

A user is entering a command into Geany, if the command is going to be
run by spawn_* will they enter it the same way as they would if the
command is going to be run by g_spawn*?  In all versions,
sync/async/pipes or not.

Colomban suggested that plugins can use g_spawn* for some commands
because they "work" for both Windows and Linux, and spawn_* for
others, but this is a bad idea if commands need to be entered
differently, since an end user then needs to know which commands to
enter in which way.

So If the answer is they are different then we need to make Geany (and
any spawning plugins with user entered commands) use all the same
commands on the platform, all spawn_* on Windows and all g_spawn* on
Linux.

Cheers
Lex

On 26 June 2015 at 03:13, Dimitar Zhekov <dimitar.zhekov at gmail.com> wrote:
> On 24.6.2015 г. 03:12, Lex Trotman wrote:
>>
>> On 24 June 2015 at 10:06, Colomban Wendling<lists.ban at herbesfolles.org>
>> wrote:
>>>
>>> Le 24/06/2015 01:57, Lex Trotman a écrit :
>>>>
>>>> Colomban,
>>>>
>>>> Correct me if I'm wrong, but despite my loudly voiced misgivings :)
>>>> doesn't the spawn_* series do command quoting and g_spawn* not?
>
>
> No. It uses quoting only internally, (a) when creating a Windows command
> line from argv, for obvious reasons, and (b) if your Windows CL program name
> contains spaces, to make sure that you won't run "C:\Program.exe" or
> "C:\Program Files\Foo.exe" if your "C:\Program Files\Foo\Bar.exe" does not
> exist. Yes, CreateProcess() will really try them, if you miss the quotes by
> mistake.
>
> [g_]spawn*() via argv produce identical results.
>
>>> Well, those support an additional "command" parameter that indeed is
>>> read in a platform-dependent manner.  (this was a discussion point and
>>> ended like this).
>>>
>>> They however also support argvs just fine, so you can use those too and
>>> they would work the same.  With this, you can also imagine using
>>> g_shell_parse_argv() on all platforms if you like, just like you would
>>> do with g_spawn().
>>
>>
>> Then Geany should be changed to do that too, for all commands (IIRC
>> build commands already do it).
>
>
> Unless one is using \ as escape character or ' for quoting under Windows,
> the commands will work. The default filetypes always contain "%x" and never
> '%x', so they will work.
>
>> Note by "user" I mean the end user, not the plugin programmer.  Having
>> the end user need to know if they should quote commands or not is bad
>> (tm).  If that is already the case then it should be fixed.
>
>
> They only need to quote a %x which may contain spaces, as usual, using
> double quotes, as in the default filetypes. The documentation examples also
> show double quotes, and unless I'm not missing something, we don't guarantee
> that \ and ' will work under Windows like in Unix.
>
> The new spawn is more Windows friendly, as it'll never treat the Windows
> directory separator \ as an escape character, and I think that will benefit
> the end users. The forward slashes will work as well (they work since MS-DOS
> 5.0).
>
> --
> E-gards: Jimmy
>
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel


More information about the Devel mailing list