def do_execute(self, stdin_file, stdout_file, stderr_file, cgroup_file):
pid = fork()
if not pid:
chdir('/in/package')
if stdin_file:
fd = os_open(stdin_file, O_RDONLY)
dup2(fd, STDIN_FILENO)
os_close(fd)
if stdout_file:
fd = os_open(stdout_file, O_WRONLY)
dup2(fd, STDOUT_FILENO)
os_close(fd)
if stderr_file:
fd = os_open(stderr_file, O_WRONLY)
dup2(fd, STDERR_FILENO)
os_close(fd)
if cgroup_file:
enter_cgroup(cgroup_file)
execve(self.execute_file, self.execute_args, SPAWN_ENV)
return wait_and_reap_zombies(pid)
评论列表
文章目录