diff options
author | Gregory P. Smith <greg@krypto.org> | 2018-04-01 19:01:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-01 19:01:48 (GMT) |
commit | 79760ed256987cead08d668b95675afba6b3760f (patch) | |
tree | 53e7a6b62a1d3960cee6b9a3f6ec92f32110ba81 /Doc/library/os.rst | |
parent | aa8e51f5ebb2a71c76059f050de01fc3c985376a (diff) | |
download | cpython-79760ed256987cead08d668b95675afba6b3760f.zip cpython-79760ed256987cead08d668b95675afba6b3760f.tar.gz cpython-79760ed256987cead08d668b95675afba6b3760f.tar.bz2 |
bpo-20104: Add os.posix_spawn documentation. (#6334)
Diffstat (limited to 'Doc/library/os.rst')
-rw-r--r-- | Doc/library/os.rst | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst index bae432d..e685b33 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -3353,6 +3353,31 @@ written in Python, such as a mail server's external command delivery program. subprocesses. +.. function:: posix_spawn(path, argv, env, file_actions=None) + + Wraps the posix_spawn() C library API for use from Python. + + Most users should use :class:`subprocess.run` instead of posix_spawn. + + The *path*, *args*, and *env* arguments are similar to :func:`execve`. + + The *file_actions* argument may be a sequence of tuples describing actions + to take on specific file descriptors in the child process between the C + library implementation's fork and exec steps. The first item in each tuple + must be one of the three type indicator listed below describing the + remaining tuple elements: + + (os.POSIX_SPAWN_OPEN, fd, path, open flags, mode) + (os.POSIX_SPAWN_CLOSE, fd) + (os.POSIX_SPAWN_DUP2, fd, new_fd) + + These tuples correspond to the C library posix_spawn_file_actions_addopen, + posix_spawn_file_actions_addclose, and posix_spawn_file_actions_adddup2 API + calls used to prepare for the posix_spawn call itself. + + .. versionadded:: 3.7 + + .. function:: register_at_fork(*, before=None, after_in_parent=None, \ after_in_child=None) |