diff options
author | Gregory P. Smith <greg@krypto.org> | 2022-04-25 23:19:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-25 23:19:39 (GMT) |
commit | cd5726fe674eaff442510eeb6c75628858be9e9f (patch) | |
tree | d311f0b144298e29596d1fb5dcc4629ec9e8647e /Lib/subprocess.py | |
parent | eddd07f840c9a4ab0ee05ce56d98caac0f072cef (diff) | |
download | cpython-cd5726fe674eaff442510eeb6c75628858be9e9f.zip cpython-cd5726fe674eaff442510eeb6c75628858be9e9f.tar.gz cpython-cd5726fe674eaff442510eeb6c75628858be9e9f.tar.bz2 |
gh-91401: Add a failsafe way to disable vfork. (#91490)
Just in case there is ever an issue with _posixsubprocess's use of
vfork() due to the complexity of using it properly and potential
directions that Linux platforms where it defaults to on could take, this
adds a failsafe so that users can disable its use entirely by setting
a global flag.
No known reason to disable it exists. But it'd be a shame to encounter
one and not be able to use CPython without patching and rebuilding it.
See the linked issue for some discussion on reasoning.
Also documents the existing way to disable posix_spawn.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r-- | Lib/subprocess.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index b58c578..a5fa152 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -702,7 +702,10 @@ def _use_posix_spawn(): return False +# These are primarily fail-safe knobs for negatives. A True value does not +# guarantee the given libc/syscall API will be used. _USE_POSIX_SPAWN = _use_posix_spawn() +_USE_VFORK = True class Popen: @@ -1792,7 +1795,7 @@ class Popen: errpipe_read, errpipe_write, restore_signals, start_new_session, gid, gids, uid, umask, - preexec_fn) + preexec_fn, _USE_VFORK) self._child_created = True finally: # be sure the FD is closed no matter what |