# all client processes own the write end of the "alive" pipe;
# when they all terminate the read end becomes ready.
- alive_r, alive_w = util.pipe()
+ alive_r, alive_w = os.pipe()
try:
fds_to_pass = [listener.fileno(), alive_r]
cmd %= (listener.fileno(), alive_r, _preload_modules, data)
def spawnv_passfds(path, args, passfds):
import _posixsubprocess, fcntl
passfds = sorted(passfds)
- tmp = []
- # temporarily unset CLOEXEC on passed fds
- for fd in passfds:
- flag = fcntl.fcntl(fd, fcntl.F_GETFD)
- if flag & fcntl.FD_CLOEXEC:
- fcntl.fcntl(fd, fcntl.F_SETFD, flag & ~fcntl.FD_CLOEXEC)
- tmp.append((fd, flag))
errpipe_read, errpipe_write = os.pipe()
try:
return _posixsubprocess.fork_exec(
finally:
os.close(errpipe_read)
os.close(errpipe_write)
- # reset CLOEXEC where necessary
- for fd, flag in tmp:
- fcntl.fcntl(fd, fcntl.F_SETFD, flag)
-
-#
-# Return pipe with CLOEXEC set on fds
-#
-# Deprecated: os.pipe() creates non-inheritable file descriptors
-# since Python 3.4
-#
-
-def pipe():
- return os.pipe()