Skip to content

Commit 9e71431

Browse files
authored
Merge pull request #1226 from colincross/close-fds
Close original pipe fd in subprocesses
2 parents a36f96c + dd2b587 commit 9e71431

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/subprocess-posix.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) {
8888
Fatal("posix_spawn_file_actions_adddup2: %s", strerror(errno));
8989
if (posix_spawn_file_actions_adddup2(&action, output_pipe[1], 2) != 0)
9090
Fatal("posix_spawn_file_actions_adddup2: %s", strerror(errno));
91+
if (posix_spawn_file_actions_addclose(&action, output_pipe[1]) != 0)
92+
Fatal("posix_spawn_file_actions_addclose: %s", strerror(errno));
9193
// In the console case, output_pipe is still inherited by the child and
9294
// closed when the subprocess finishes, which then notifies ninja.
9395
}

0 commit comments

Comments
 (0)