gh-113117: Support posix_spawn in subprocess.Popen with close_fds=True (#113118)

Add support for `os.POSIX_SPAWN_CLOSEFROM` and
`posix_spawn_file_actions_addclosefrom_np` and have the `subprocess` module use
them when available.  This means `posix_spawn` can now be used in the default
`close_fds=True` situation on many platforms.

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
This commit is contained in:
Jakub Kulík 2023-12-17 22:34:57 +01:00 committed by GitHub
parent 32d87a8899
commit 2b93f52242
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 91 additions and 5 deletions

6
configure generated vendored
View file

@ -17779,6 +17779,12 @@ if test "x$ac_cv_func_posix_spawnp" = xyes
then :
printf "%s\n" "#define HAVE_POSIX_SPAWNP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "posix_spawn_file_actions_addclosefrom_np" "ac_cv_func_posix_spawn_file_actions_addclosefrom_np"
if test "x$ac_cv_func_posix_spawn_file_actions_addclosefrom_np" = xyes
then :
printf "%s\n" "#define HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSEFROM_NP 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "pread" "ac_cv_func_pread"
if test "x$ac_cv_func_pread" = xyes