def _as_child(self, process, gnupg_commands, args):
"""Stuff run after forking in child"""
# child
for std in _stds:
p = process._pipes[std]
os.dup2(p.child, getattr(sys, "__%s__" % std).fileno())
for k, p in process._pipes.items():
if p.direct and k not in _stds:
# we want the fh to stay open after execing
fcntl.fcntl(p.child, fcntl.F_SETFD, 0)
fd_args = []
for k, p in process._pipes.items():
# set command-line options for non-standard fds
if k not in _stds:
fd_args.extend([_fd_options[k], "%d" % p.child])
if not p.direct:
os.close(p.parent)
command = [self.call] + fd_args + self.options.get_args() + gnupg_commands + args
os.execvp(command[0], command)
评论列表
文章目录