diff options
author | Jeremy Katz <katzj@redhat.com> | 2004-08-03 18:37:59 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2004-08-03 18:37:59 +0000 |
commit | 3e2c1824824a94191198fab134e2bc5ea0acb862 (patch) | |
tree | 39978d4f7c80609ae20e0f5ab46fd8c6e110ac75 /iutil.py | |
parent | 82b29100020026059cdcd53193909dd75a43c7b4 (diff) | |
download | anaconda-3e2c1824824a94191198fab134e2bc5ea0acb862.tar.gz anaconda-3e2c1824824a94191198fab134e2bc5ea0acb862.tar.xz anaconda-3e2c1824824a94191198fab134e2bc5ea0acb862.zip |
allow for doing something with stderr when doing an execWithCapture (part
of #128814)
Diffstat (limited to 'iutil.py')
-rw-r--r-- | iutil.py | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -109,7 +109,7 @@ def execWithRedirect(command, argv, stdin = 0, stdout = 1, stderr = 2, return status def execWithCapture(command, argv, searchPath = 0, root = '/', stdin = 0, - catchfd = 1, closefd = -1): + stderr = 2, catchfd = 1, closefd = -1): if not searchPath and not os.access (root + command, os.X_OK): raise RuntimeError, command + " can not be run" @@ -130,6 +130,15 @@ def execWithCapture(command, argv, searchPath = 0, root = '/', stdin = 0, os.dup2(stdin, 0) os.close(stdin) + if stderr == sys.stdout: + stderr = sys.stdout.fileno() + else: + stderr = getfd(stderr) + + if stderr != 2: + os.dup2(stderr, 2) + os.close(stderr) + if (searchPath): os.execvp(command, argv) else: |