# http://bugs.jython.org/issue1074
fcntl = None
-from _emerge.SubProcess import SubProcess
+import platform
import sys
+
+from _emerge.SubProcess import SubProcess
import portage
from portage import os
from portage.const import BASH_BINARY
from portage.util._async.PipeLogger import PipeLogger
-# https://bugs.gentoo.org/show_bug.cgi?id=456296
-import platform
-if platform.system() in ("Darwin",):
- # disable FD_CLOEXEC on stdout, breaks horribly
- fcntl = None
+# On Darwin, FD_CLOEXEC triggers errno 35 for stdout (bug #456296)
+_disable_cloexec_stdout = platform.system() in ("Darwin",)
class SpawnProcess(SubProcess):
stdout_fd = None
if can_log and not self.background:
stdout_fd = os.dup(fd_pipes_orig[1])
- if fcntl is not None:
+ if fcntl is not None and not _disable_cloexec_stdout:
try:
fcntl.FD_CLOEXEC
except AttributeError: