Close stderr of child processes on MacOS
This fixes a bug on some modern mac systems. Related to setup_logging() changing stderr to use ASL and write to com.apple.console. When a forked application writes to stderr while ASL is used, the child is terminated for some reason.
This commit is contained in:
parent
a390d8d3ca
commit
8b5437301b
@ -897,8 +897,11 @@ SystemExec::start (StdErrMode stderr_mode, const char *vfork_exec_wrapper)
|
|||||||
} else if (stderr_mode == IgnoreAndClose) {
|
} else if (stderr_mode == IgnoreAndClose) {
|
||||||
/* ignore STDERR */
|
/* ignore STDERR */
|
||||||
::close(STDERR_FILENO);
|
::close(STDERR_FILENO);
|
||||||
} else {
|
} else { /* stderr_mode == ShareWithParent */
|
||||||
/* keep STDERR */
|
/* keep STDERR */
|
||||||
|
#if defined __APPLE__&& defined ASL_LOG_DESCRIPTOR_WRITE
|
||||||
|
::close(STDERR_FILENO);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pout[1] != STDOUT_FILENO && pout[1] != STDERR_FILENO) {
|
if (pout[1] != STDOUT_FILENO && pout[1] != STDERR_FILENO) {
|
||||||
|
Loading…
Reference in New Issue
Block a user