[Geany-Devel] Spawn module API

Lex Trotman elextr at xxxxx
Sat Jun 27 01:40:00 UTC 2015


On 27 June 2015 at 03:13, Dimitar Zhekov <dimitar.zhekov at gmail.com> wrote:
> On 26.6.2015 г. 01:47, Lex Trotman wrote:
>
>> Hi Dimitar,
>
>
> Hi, Lex.
>
>> On 26 June 2015 at 03:13, Dimitar Zhekov<dimitar.zhekov at gmail.com> wrote:
>>>
>>>
>>> It uses quoting internally [...bla-bla-bla unneeded tech details...]
>>
>>
>> I'm now totally confused, so let me ask the important question directly:
>
>
> I should have been more terse, sorry. :)

Thats ok, maybe I havn't been totally clear about where I see the
"problem" and its impact on the exposed API.

>
>> 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.
>
>
> Short answer: yes.
>
> (Long answer: spawning under Unix and Windows was never exactly the same.
> When splitting a command line into an argument vector with
> g_shell_parse_argv(), and then running it with g_spawn(), or using
> g_spawn('/bin/sh', command), which are the standard practices under Unix, \
> will work as escape character, and ' as argument quoter, as expected under
> *nix. That doesn't work under Windows, didn't work in 1.23/1.24 either, and
> I haven't checked any earlier versions.)

Your long answer contradicts your short answer by illustrating some
places where they differ. :)

My concern is that, for a given platform, all commands a user enters
into Geany or plugins should use the same meta chars and quoting.  My
concern is that a user should not be faced with the problem that some
commands have to be entered with windows rules and some with unix
rules.

Many plugins currently do their own command parsing to get an argv and
others use g_spawn_command (which is hard wired to unix rules, it uses
g_shell_parse_argv).  On windows these plugins will now use different
rules to the build commands because the build commands use spawn_* and
get platform dependent rules.

These plugins should be encouraged to switch to the same rules as
Geany, ie to use spawn_* calls with a cmd not an argv.  That means the
appropriate spawn_* API should be available.

The API we need to expose for this is the API that allows an unparsed
command to be used, not versions that only allow argv.

So the spawn API that is a drop in replacement for g_spawn is only
needed where g_spawn doesn't work, and then it should only be used as
a temporary workaround until the plugins move to using the cmd
version.

So to me that means:

/* platform dependent checking */

spawn_get_program_name
spawn_check_command

/* platform dependent running */

spawn_with_callbacks
spawn_async
spawn_sync

/* associated support functions */

spawn_kill_process
spawn_write_data
spawn_get_exit_status_callback


Cheers
Lex

>
>
> --
> 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