diff options
Diffstat (limited to 'base/process_util_posix.cc')
-rw-r--r-- | base/process_util_posix.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc index a03b45c..6ff660f 100644 --- a/base/process_util_posix.cc +++ b/base/process_util_posix.cc @@ -441,6 +441,11 @@ bool GetAppOutput(const CommandLine& cl, std::string* output) { return false; case 0: // child { + // Obscure fork() rule: in the child, if you don't end up doing exec*(), + // you call _exit() instead of exit(). This is because _exit() does not + // call any previously-registered (in the parent) exit handlers, which + // might do things like block waiting for threads that don't even exist + // in the child. int dev_null = open("/dev/null", O_WRONLY); if (dev_null < 0) _exit(127); |