Close original pipe fd in subprocesses

Non-console subprocesses have the write end of a pipe connected to fds
1 and 2 for stdout and stderr, but they also have the it connected to
whatever fd was assigned in the ninja process when the pipe was
created.  Add a call to posix_spawn_file_actions_addclose after
the posix_spawn_file_actions_adddup2 calls to close the original fd
once it has been dup'd to stdout and stderr.

This fixes an issue seen in the Android build, where one of the
subprocesses is used to start a background helper process.  The
background process attempts to close any inherited fds, but if ninja
used a very large fd number due to a high parallelism count the
background process would not close the fd and ninja would never
consider the subprocess finished.
1 file changed