From 751c636d562b1da459b65f18065070d406df2e28 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 23 Mar 2013 16:00:17 -0700 Subject: [PATCH] SubProcess: re-organize Darwin/fcntl logic --- pym/_emerge/SpawnProcess.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pym/_emerge/SpawnProcess.py b/pym/_emerge/SpawnProcess.py index c54988446..25859a9cd 100644 --- a/pym/_emerge/SpawnProcess.py +++ b/pym/_emerge/SpawnProcess.py @@ -7,18 +7,17 @@ except ImportError: # 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): @@ -120,7 +119,7 @@ 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: -- 2.26.2