summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2013-01-07 18:08:40 -0800
committerZac Medico <zmedico@gentoo.org>2013-01-07 18:09:48 -0800
commit2a05612d23561d4606e93e73a8e021dc91291ff6 (patch)
treefd4135651c6bcfe869bda59212724549be3d037d
parentf254a3a8135e9b32ae931dffdc36c4fbfe813cc3 (diff)
downloadportage-2a05612d23561d4606e93e73a8e021dc91291ff6.tar.gz
portage-2a05612d23561d4606e93e73a8e021dc91291ff6.tar.bz2
portage-2a05612d23561d4606e93e73a8e021dc91291ff6.zip
SpawnProcess: stdout_fd FD_CLOEXEC
-rw-r--r--pym/_emerge/SpawnProcess.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/pym/_emerge/SpawnProcess.py b/pym/_emerge/SpawnProcess.py
index 293e5be8c..f226dcb8f 100644
--- a/pym/_emerge/SpawnProcess.py
+++ b/pym/_emerge/SpawnProcess.py
@@ -1,6 +1,12 @@
# Copyright 2008-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+try:
+ import fcntl
+except ImportError:
+ # http://bugs.jython.org/issue1074
+ fcntl = None
+
from _emerge.SubProcess import SubProcess
import sys
import portage
@@ -105,6 +111,15 @@ 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:
+ try:
+ fcntl.FD_CLOEXEC
+ except AttributeError:
+ pass
+ else:
+ fcntl.fcntl(stdout_fd, fcntl.F_SETFL,
+ fcntl.fcntl(stdout_fd,
+ fcntl.F_GETFL) | fcntl.FD_CLOEXEC)
self._pipe_logger = PipeLogger(background=self.background,
scheduler=self.scheduler, input_fd=master_fd,