diff options
author | Matt Wilson <msw@redhat.com> | 2002-07-08 20:13:39 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 2002-07-08 20:13:39 +0000 |
commit | b38096a59562c1a2edeb591661919e586dd69194 (patch) | |
tree | 5686ee921471f308fbd306192fbfe2365751764c /iutil.py | |
parent | 2da1310078662e0a58af3aa5cfc6de874ae587a6 (diff) | |
download | anaconda-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.py | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -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) |