summaryrefslogtreecommitdiffstats
path: root/src/subprocess-posix.cc
Commit message (Collapse)AuthorAgeFilesLines
* Close original pipe fd in subprocessesColin Cross2017-01-131-0/+2
| | | | | | | | | | | | | | | | 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.
* Use POSIX_SPAWN_USEVFORK if availablemalc2016-08-261-2/+3
| | | | | | | | Existing comments were alluding to it's usage and it makes building ninja itself go a litle bit faster (i.e. taking less wall clock time). FWIW FreeBSD even uses vfork by default c.f. https://www.freebsd.org/cgi/man.cgi?query=posix_spawn
* Use posix_spawn() instead of fork()/exec().Nico Weber2016-03-211-53/+54
| | | | | posix_spawn() is a syscall on OS X and Solaris and a bit faster. It's also easier emulate for cygwin, and the code is a bit simpler.
* Revert #910.Nico Weber2016-03-051-5/+2
| | | | | | | | | | | The change caused some issues (it makes it impossible ot use posix_spawn() and makes it harder to suspend children on ctrl-z). After discussing with jln: Since it fixes a corner case that can be fixed by explicitly running commands that need it in a wrapper that setsid()s them, let's try reverting it for a while. Please shout if this is a problem for you. See also #1097.
* Cleanup build on SIGHUP.Nicolas Despres2015-09-201-1/+11
| | | | | SIGHUP is sent when the connection hang up (i.e. when the terminal window is closed or the ssh connection is closed).
* Forward interruption signal to child processes.Nicolas Despres2015-04-241-28/+28
|
* Allow SIGTERM for interruption.Nicolas Despres2015-04-241-4/+11
| | | | | Default signal sent by many other programs (mainly kill(1)) to gently terminates another one is SIGTERM.
* POSIX: detach background subprocesses from terminal.Julien Tinnes2015-01-291-2/+5
| | | | | | | | Put background subprocesses (i.e. subprocesses with no access to the console) in their own session and detach them from the terminal. This fixes martine/ninja#909.
* Check pending SIGINT after ppoll/pselectTaiju Tsuiki2015-01-191-0/+21
| | | | | | | | | ppoll/pselect prioritizes file descriptor events over a signal delivery. So a flood of events prevents ninja from reacting keyboard interruption by the user. This CL adds a check for pending keyboard interruptions after file descriptor events.
* win console wip: Fix comments based on review feedback.Nico Weber2014-05-181-1/+1
|
* win console wip: resolve FIXMENico Weber2014-05-141-0/+1
|
* wip for console pool on windowsNico Weber2014-05-131-0/+2
|
* Introduce the "console" poolPeter Collingbourne2014-02-031-22/+28
| | | | | | | This is a pre-defined pool with a depth of 1. It has the special property that any task in the pool has direct access to the console. This can be useful for interactive tasks or long-running tasks which produce status updates on the console (such as test suites).
* use !defined(NOT_PPOLL)David Hill2013-07-011-2/+2
|
* cleanup based on comments from martineDavid Hill2013-06-291-1/+1
|
* support BitrigDavid Hill2013-06-291-3/+3
|
* Added bootstrap/configure option to force pselectTobias Hieta2013-05-231-3/+3
| | | | | | | | | | | | All modern Linux kernels have ppoll() but sometimes you might want to compile on something ancient. This patch adds the possibility to force the use of pselect() instead by passing --force-pselect to bootstrap/configure. The use of ppoll() is still default for Linux and OpenBSD
* Remove a few unused includes.Nico Weber2013-05-121-2/+0
|
* Don't poll pipes using POLLRDHUPMatthew Dempsky2013-05-011-8/+1
| | | | | | POLLRDHUP is Linux-specific, and isn't necessary for polling pipes anyway. Linux and OpenBSD both return POLLHUP if no process has the pipe open for writing.
* Add support for OpenBSD.Matthew Dempsky2013-05-011-17/+13
| | | | | | Use ppoll() on OpenBSD. Also, fix interrupt handling to recognize that on FreeBSD and OpenBSD, an interrupt might have been delivered even if pselect()/ppoll() don't return -1/EINTR.
* correctly open /dev/null in subprocessesEvan Martin2012-12-211-1/+1
| | | | Fixes issue #468.
* rename subprocess.cc to reflex its posixnessEvan Martin2012-07-271-0/+300