summaryrefslogtreecommitdiffstats
path: root/iutil.py
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>1999-08-28 15:52:26 +0000
committerErik Troan <ewt@redhat.com>1999-08-28 15:52:26 +0000
commit6d9c007e94a6e7eb15681838d41c33031a6690c4 (patch)
tree320831c5f294d1cd9459aad6ee0ef43363739a4b /iutil.py
parent4e72b77944ba4183f4ac64789ad010580553c4d5 (diff)
downloadanaconda-6d9c007e94a6e7eb15681838d41c33031a6690c4.tar.gz
anaconda-6d9c007e94a6e7eb15681838d41c33031a6690c4.tar.xz
anaconda-6d9c007e94a6e7eb15681838d41c33031a6690c4.zip
iutil.py
Diffstat (limited to 'iutil.py')
-rw-r--r--iutil.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/iutil.py b/iutil.py
index 402d83c3c..2ef20d186 100644
--- a/iutil.py
+++ b/iutil.py
@@ -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: