From 67f618433366316dca8e8c5cdc08e106e268c81a Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 3 Jan 2013 20:16:17 -0800 Subject: Enable FD_CLOEXEC for non-blocking pipes. --- pym/portage/dbapi/_MergeProcess.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'pym/portage/dbapi') diff --git a/pym/portage/dbapi/_MergeProcess.py b/pym/portage/dbapi/_MergeProcess.py index e2534cf9d..1442d56ac 100644 --- a/pym/portage/dbapi/_MergeProcess.py +++ b/pym/portage/dbapi/_MergeProcess.py @@ -114,8 +114,17 @@ class MergeProcess(ForkProcess): """ elog_reader_fd, elog_writer_fd = os.pipe() + + fcntl_flags = os.O_NONBLOCK + try: + fcntl.FD_CLOEXEC + except AttributeError: + pass + else: + fcntl_flags |= fcntl.FD_CLOEXEC + fcntl.fcntl(elog_reader_fd, fcntl.F_SETFL, - fcntl.fcntl(elog_reader_fd, fcntl.F_GETFL) | os.O_NONBLOCK) + fcntl.fcntl(elog_reader_fd, fcntl.F_GETFL) | fcntl_flags) blockers = None if self.blockers is not None: # Query blockers in the main process, since closing -- cgit v1.2.3-1-g7c22