Subject: Re: bug#52835: [PATCH 0/2] Fix spawning a child not setting standard fds properly

From: Josselin Poiret <[email-masked]>
Date: Sat, 07 Jan 2023 17:07:01 +0100

Hi Ludo,

Happy new year!

Ludovic Courtès <[email-masked]> writes:

> ‘spawn*’ is expressive enough, but a procedure with 6 positional
> arguments cannot be exposed as-is IMO.
>
> One tiny thing that’s missing is a boolean to choose between
> ‘posix_spawn’ and ‘posix_spawnp’.
>
> So we need either ‘spawn’ defined in Scheme as you did, or directly use
> ‘scm_c_bind_keyword_arguments’ right in ‘scm_spawn_process’ (info
> "(guile) Keyword Procedures"), to avoid ending up with two procedures.
> I’m fine either way.

I've done the above by using the C functions to bind keyword arguments,
and added the #:use-path? keyword argument.  One annoying thing though
is that since it uses keyword arguments, the first line of the
documentation generated by SCM_DEFINE only mentions "spawn program
. keyword_args".

>> Do we need to add a documentation page as well?
>
> Yes, please.  :-)  I realize I’m asking a lot of things, so let me know
> if you’d like to share the workload somehow.
>
> Doc could go in the “Processes” section, or possibly in a new section
> we’d add right after it, “Spawning Programs”.  We should probably add a
> “@quotation Note” in the doc of ‘primitive-fork’ that briefly explains
> why people should probably use ‘spawn’ rather than fork + exec.

I've opted to put it right below primitive-fork, and slightly rewrite
the part about pipes in primitive-fork's description to also mention
spawn.  Let me know if the documentation is not descriptive enough.

WDYT?
-- 
Josselin Poiret