From: Zac Medico Date: Sat, 23 Mar 2013 23:00:17 +0000 (-0700) Subject: SubProcess: re-organize Darwin/fcntl logic X-Git-Tag: v2.2.0_alpha170~9 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=751c636d562b1da459b65f18065070d406df2e28;p=portage.git SubProcess: re-organize Darwin/fcntl logic --- 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: