Skip to content

Commit

Permalink
Merge pull request #307 from bgamari/wip/T306
Browse files Browse the repository at this point in the history
fork-exec: Don't double-close parent fds
  • Loading branch information
snoyberg authored Mar 31, 2024
2 parents a590acd + 8a9bf8b commit a6b7cc6
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions cbits/posix/fork_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,16 +335,8 @@ do_spawn_fork (char *const args[],
// our responsibility to reap here as nobody else can.
waitpid(pid, NULL, 0);

// Already closed child ends above
if (stdInHdl->behavior == STD_HANDLE_USE_PIPE) {
close(stdInHdl->use_pipe.parent_end);
}
if (stdOutHdl->behavior == STD_HANDLE_USE_PIPE) {
close(stdOutHdl->use_pipe.parent_end);
}
if (stdErrHdl->behavior == STD_HANDLE_USE_PIPE) {
close(stdErrHdl->use_pipe.parent_end);
}
// No need to close stdin, et al. here as runInteractiveProcess will
// handle this. See #306.

pid = -1;
}
Expand Down

0 comments on commit a6b7cc6

Please sign in to comment.