summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/AsynchronousLock.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/_emerge/AsynchronousLock.py')
-rw-r--r--pym/_emerge/AsynchronousLock.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/pym/_emerge/AsynchronousLock.py b/pym/_emerge/AsynchronousLock.py
index 2de1acdcf..fd66a9455 100644
--- a/pym/_emerge/AsynchronousLock.py
+++ b/pym/_emerge/AsynchronousLock.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Gentoo Foundation
+# Copyright 2010-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import dummy_threading
@@ -164,8 +164,17 @@ class _LockProcess(AbstractPollTask):
self._files = {}
self._files['pipe_in'] = in_pr
self._files['pipe_out'] = out_pw
+
+ fcntl_flags = os.O_NONBLOCK
+ try:
+ fcntl.FD_CLOEXEC
+ except AttributeError:
+ pass
+ else:
+ fcntl_flags |= fcntl.FD_CLOEXEC
+
fcntl.fcntl(in_pr, fcntl.F_SETFL,
- fcntl.fcntl(in_pr, fcntl.F_GETFL) | os.O_NONBLOCK)
+ fcntl.fcntl(in_pr, fcntl.F_GETFL) | fcntl_flags)
self._reg_id = self.scheduler.io_add_watch(in_pr,
self.scheduler.IO_IN, self._output_handler)
self._registered = True