From 8b5437301b8510339cce87c0c11c1dc9ec8d92a4 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 5 Mar 2019 19:11:10 +0100 Subject: 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. --- libs/pbd/system_exec.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libs/pbd') diff --git a/libs/pbd/system_exec.cc b/libs/pbd/system_exec.cc index 23f808a0c3..6be62ef8ef 100644 --- a/libs/pbd/system_exec.cc +++ b/libs/pbd/system_exec.cc @@ -897,8 +897,11 @@ SystemExec::start (StdErrMode stderr_mode, const char *vfork_exec_wrapper) } else if (stderr_mode == IgnoreAndClose) { /* ignore STDERR */ ::close(STDERR_FILENO); - } else { + } else { /* stderr_mode == ShareWithParent */ /* keep STDERR */ +#if defined __APPLE__&& defined ASL_LOG_DESCRIPTOR_WRITE + ::close(STDERR_FILENO); +#endif } if (pout[1] != STDOUT_FILENO && pout[1] != STDERR_FILENO) { -- cgit v1.2.3