Back to module index
Go to module by name
_posixsubprocess
A POSIX helper for the subprocess module.
Functions
fork_exec
fork_exec(...)
fork_exec(args, executable_list, close_fds, pass_fds, cwd, env,
p2cread, p2cwrite, c2pread, c2pwrite,
errread, errwrite, errpipe_read, errpipe_write,
restore_signals, call_setsid,
gid, groups_list, uid,
preexec_fn)
Forks a child process, closes parent file descriptors as appropriate in the
child and dups the few that are needed before calling exec() in the child
process.
If close_fds is true, close file descriptors 3 and higher, except those listed
in the sorted tuple pass_fds.
The preexec_fn, if supplied, will be called immediately before closing file
descriptors and exec.
WARNING: preexec_fn is NOT SAFE if your application uses threads.
It may trigger infrequent, difficult to debug deadlocks.
If an error occurs in the child process before the exec, it is
serialized and written to the errpipe_write fd per subprocess.py.
Returns: the child process's PID.
Raises: Only on an error in the parent process.