Subject: bug#52835: [PATCH v6 0/3] Move spawning procedures to posix_spawn.

From: Josselin Poiret <[email-masked]>
Date: Thu, 22 Dec 2022 13:49:07 +0100

Hello Ludo,

Here is hopefully the last reroll of this patchset.  First of all, I did not
include the gnulib patch again because it still applies cleanly and it is
extremely large, but it should be applied before those 3 patches.

The first two patches should be applied on the current major release, while the
third one should be applied on the next major release to finish the migration to
spawn.

The first patch adds the new spawn* procedure, using an internal do_spawn
function.  The second patch changes system* and piped-process to use this new
function, but it still tries to mimick the old behavior of start_child by
inspecting the possible errnos, and spawning a dummy child that instantly exits
with code 127 in some cases.

The third patch gets rid of those special cases, which makes system* and friends
throw more exceptions instead of having the child fail with exit code 127 (note
that YMMV depending on how spawn is implemented for your system).

I've added docstrings to user-facing Guile procedures, and also did the
micro-optimization we talked about, since I had already factorized do_spawn.

The tests seem to pass both with and without 3.

One nice thing I've noticed is that gnulib has posix_spawn for WinNT as well,
which means it might be okay to remove the dependency on having fork for
system*, among others!

WDYT?

Josselin Poiret (3):
  Add spawn*.
  Make system* and piped-process internally use spawn.
  Move popen and posix procedures to spawn*.

 libguile/posix.c            | 248 +++++++++++-------------------------
 libguile/posix.h            |   2 +
 module/ice-9/popen.scm      |  87 +++++++++----
 test-suite/tests/popen.test |  14 +-
 test-suite/tests/posix.test |  36 +++---
 5 files changed, 161 insertions(+), 226 deletions(-)

base-commit: f3ea8f7fa1d84a559c7bf834fe5b675abe0ae7b8
prerequisite-patch-id: 71184f71260952109165ec62c588c2b646e238f6
-- 
2.38.1