summaryrefslogtreecommitdiffstats
path: root/iutil.py
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2002-07-08 20:13:39 +0000
committerMatt Wilson <msw@redhat.com>2002-07-08 20:13:39 +0000
commitb38096a59562c1a2edeb591661919e586dd69194 (patch)
tree5686ee921471f308fbd306192fbfe2365751764c /iutil.py
parent2da1310078662e0a58af3aa5cfc6de874ae587a6 (diff)
downloadanaconda-b38096a59562c1a2edeb591661919e586dd69194.tar.gz
anaconda-b38096a59562c1a2edeb591661919e586dd69194.tar.xz
anaconda-b38096a59562c1a2edeb591661919e586dd69194.zip
only check access on execv, not execvp. don't raise exceptions after the fork()
Diffstat (limited to 'iutil.py')
-rw-r--r--iutil.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/iutil.py b/iutil.py
index d39b778dc..80c3a0cb1 100644
--- a/iutil.py
+++ b/iutil.py
@@ -60,7 +60,7 @@ def execWithRedirect(command, argv, stdin = 0, stdout = 1, stderr = 2,
stdout = getfd(stdout)
stderr = getfd(stderr)
- if not os.access (root + command, os.X_OK):
+ if not searchPath and not os.access (root + command, os.X_OK):
raise RuntimeError, command + " can not be run"
childpid = os.fork()
@@ -91,10 +91,14 @@ def execWithRedirect(command, argv, stdin = 0, stdout = 1, stderr = 2,
os.dup2(stderr, 2)
os.close(stderr)
- if (searchPath):
- os.execvp(command, argv)
- else:
- os.execv(command, argv)
+ try:
+ if (searchPath):
+ os.execvp(command, argv)
+ else:
+ os.execv(command, argv)
+ except OSError:
+ # let the caller deal with the exit code of 1.
+ pass
sys.exit(1)