authorgravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2018-11-28 18:33:55-05:00
committergravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2018-11-28 18:33:55-05:00
log11e8afb37cea3d4b951165f382eeee36a653978f
tree0ca15aacb483c9050cf06f027a1a303b1e884e3a
parent57f44eb2bd17fc0c4e9d09b8c8621867f784d2f0

fix child_process piped streams not getting closed


1 files changed, 13 insertions(+), 0 deletions(-)

std/os/child_process.zig+13
...@@ -390,6 +390,19 @@ pub const ChildProcess = struct {...@@ -390,6 +390,19 @@ pub const ChildProcess = struct {
390 setUpChildIo(self.stdout_behavior, stdout_pipe[1], posix.STDOUT_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);390 setUpChildIo(self.stdout_behavior, stdout_pipe[1], posix.STDOUT_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);
391 setUpChildIo(self.stderr_behavior, stderr_pipe[1], posix.STDERR_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);391 setUpChildIo(self.stderr_behavior, stderr_pipe[1], posix.STDERR_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);
392392
393 if (self.stdin_behavior == StdIo.Pipe) {
394 os.close(stdin_pipe[0]);
395 os.close(stdin_pipe[1]);
396 }
397 if (self.stdout_behavior == StdIo.Pipe) {
398 os.close(stdout_pipe[0]);
399 os.close(stdout_pipe[1]);
400 }
401 if (self.stderr_behavior == StdIo.Pipe) {
402 os.close(stderr_pipe[0]);
403 os.close(stderr_pipe[1]);
404 }
405
393 if (self.cwd) |cwd| {406 if (self.cwd) |cwd| {
394 os.changeCurDir(self.allocator, cwd) catch |err| forkChildErrReport(err_pipe[1], err);407 os.changeCurDir(self.allocator, cwd) catch |err| forkChildErrReport(err_pipe[1], err);
395 }408 }