fix child_process piped streams not getting closed

This commit is contained in:
Josh Wolfe 2018-11-28 18:33:55 -05:00
parent 57f44eb2bd
commit 11e8afb37c

View File

@ -390,6 +390,19 @@ pub const ChildProcess = struct {
setUpChildIo(self.stdout_behavior, stdout_pipe[1], posix.STDOUT_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);
setUpChildIo(self.stderr_behavior, stderr_pipe[1], posix.STDERR_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);
if (self.stdin_behavior == StdIo.Pipe) {
os.close(stdin_pipe[0]);
os.close(stdin_pipe[1]);
}
if (self.stdout_behavior == StdIo.Pipe) {
os.close(stdout_pipe[0]);
os.close(stdout_pipe[1]);
}
if (self.stderr_behavior == StdIo.Pipe) {
os.close(stderr_pipe[0]);
os.close(stderr_pipe[1]);
}
if (self.cwd) |cwd| {
os.changeCurDir(self.allocator, cwd) catch |err| forkChildErrReport(err_pipe[1], err);
}