diff options
author | Erik Troan <ewt@redhat.com> | 1999-08-28 15:52:26 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 1999-08-28 15:52:26 +0000 |
commit | 6d9c007e94a6e7eb15681838d41c33031a6690c4 (patch) | |
tree | 320831c5f294d1cd9459aad6ee0ef43363739a4b /iutil.py | |
parent | 4e72b77944ba4183f4ac64789ad010580553c4d5 (diff) | |
download | anaconda-6d9c007e94a6e7eb15681838d41c33031a6690c4.tar.gz anaconda-6d9c007e94a6e7eb15681838d41c33031a6690c4.tar.xz anaconda-6d9c007e94a6e7eb15681838d41c33031a6690c4.zip |
iutil.py
Diffstat (limited to 'iutil.py')
-rw-r--r-- | iutil.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -20,7 +20,8 @@ def execWithRedirect(command, argv, stdin = 0, stdout = 1, stderr = 2, childpid = os.fork() if (not childpid): - isys.chroot (root) + if (root != '/'): isys.chroot (root) + if stdin != 0: os.dup2(stdin, 0) os.close(stdin) @@ -41,7 +42,7 @@ def execWithRedirect(command, argv, stdin = 0, stdout = 1, stderr = 2, return status -def execWithCapture(command, argv, searchPath = 0, root = '/'): +def execWithCapture(command, argv, searchPath = 0, root = '/', stdin = 0): (read, write) = os.pipe() @@ -50,6 +51,10 @@ def execWithCapture(command, argv, searchPath = 0, root = '/'): if (root != '/'): isys.chroot (root) os.dup2(write, 1) + if stdin: + os.dup2(stdin, 0) + os.close(stdin) + if (searchPath): os.execvp(command, argv) else: |