From: Zac Medico Date: Mon, 2 Sep 2013 00:55:21 +0000 (-0700) Subject: _setup_pipes: fix for Python 3.1 to 3.3 X-Git-Tag: v2.2.2~12 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=617c0ebf31f09e424442e0bc2e7e5b1c6407a056;p=portage.git _setup_pipes: fix for Python 3.1 to 3.3 This fixes a case where /dev/null stdin fails to inherit since commit bd2128b7a750a68470f857162784e55b8ac39de2. --- diff --git a/pym/portage/process.py b/pym/portage/process.py index 2a2fcac77..9ae7a55ff 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -583,9 +583,14 @@ def _setup_pipes(fd_pipes, close_fds=True, inheritable=None): if oldfd != newfd: os.dup2(oldfd, newfd) - if old_fdflags is None: - old_fdflags = fcntl.fcntl(oldfd, fcntl.F_GETFD) - fcntl.fcntl(newfd, fcntl.F_SETFD, old_fdflags) + if _set_inheritable is not None: + # Don't do this unless _set_inheritable is available, + # since it's used below to ensure correct state, and + # otherwise /dev/null stdin fails to inherit (at least + # with Python versions from 3.1 to 3.3). + if old_fdflags is None: + old_fdflags = fcntl.fcntl(oldfd, fcntl.F_GETFD) + fcntl.fcntl(newfd, fcntl.F_SETFD, old_fdflags) if _set_inheritable is not None: