1 |
commit: 617c0ebf31f09e424442e0bc2e7e5b1c6407a056 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Sep 2 00:55:21 2013 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 2 00:55:21 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=617c0ebf |
7 |
|
8 |
_setup_pipes: fix for Python 3.1 to 3.3 |
9 |
|
10 |
This fixes a case where /dev/null stdin fails to inherit since commit |
11 |
bd2128b7a750a68470f857162784e55b8ac39de2. |
12 |
|
13 |
--- |
14 |
pym/portage/process.py | 11 ++++++++--- |
15 |
1 file changed, 8 insertions(+), 3 deletions(-) |
16 |
|
17 |
diff --git a/pym/portage/process.py b/pym/portage/process.py |
18 |
index 2a2fcac..9ae7a55 100644 |
19 |
--- a/pym/portage/process.py |
20 |
+++ b/pym/portage/process.py |
21 |
@@ -583,9 +583,14 @@ def _setup_pipes(fd_pipes, close_fds=True, inheritable=None): |
22 |
|
23 |
if oldfd != newfd: |
24 |
os.dup2(oldfd, newfd) |
25 |
- if old_fdflags is None: |
26 |
- old_fdflags = fcntl.fcntl(oldfd, fcntl.F_GETFD) |
27 |
- fcntl.fcntl(newfd, fcntl.F_SETFD, old_fdflags) |
28 |
+ if _set_inheritable is not None: |
29 |
+ # Don't do this unless _set_inheritable is available, |
30 |
+ # since it's used below to ensure correct state, and |
31 |
+ # otherwise /dev/null stdin fails to inherit (at least |
32 |
+ # with Python versions from 3.1 to 3.3). |
33 |
+ if old_fdflags is None: |
34 |
+ old_fdflags = fcntl.fcntl(oldfd, fcntl.F_GETFD) |
35 |
+ fcntl.fcntl(newfd, fcntl.F_SETFD, old_fdflags) |
36 |
|
37 |
if _set_inheritable is not None: |