summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-01-17 21:57:55 (GMT)
committerGreg Ward <gward@python.net>2000-01-17 21:57:55 (GMT)
commit3b49c9babd61338ac050d1c7c3e4e6909eaa46d9 (patch)
tree7f3a418f836591d3bd93abed34c59edd5d68fefd /Lib/distutils
parent01f5215828749f01f3c1857e78ac3a49adb12704 (diff)
downloadcpython-3b49c9babd61338ac050d1c7c3e4e6909eaa46d9.zip
cpython-3b49c9babd61338ac050d1c7c3e4e6909eaa46d9.tar.gz
cpython-3b49c9babd61338ac050d1c7c3e4e6909eaa46d9.tar.bz2
Catch OSError from 'spawnv()' in '_spawn_nt()'.
Tweaked error messages in '_spawn_posix()'.
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/spawn.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/distutils/spawn.py b/Lib/distutils/spawn.py
index eee8e7f..9a88ac8 100644
--- a/Lib/distutils/spawn.py
+++ b/Lib/distutils/spawn.py
@@ -63,9 +63,16 @@ def _spawn_nt ( cmd,
print string.join ( [executable] + cmd[1:], ' ')
if not dry_run:
# spawn for NT requires a full path to the .exe
- rc = os.spawnv (os.P_WAIT, executable, cmd)
+ try:
+ rc = os.spawnv (os.P_WAIT, executable, cmd)
+ except OSError, exc:
+ # this seems to happen when the command isn't found
+ raise DistutilsExecError, \
+ "command '%s' failed: %s" % (cmd[0], exc[-1])
if rc != 0:
- raise DistutilsExecError("command failed: %d" % rc)
+ # and this reflects the command running but failing
+ raise DistutilsExecError, \
+ "command '%s' failed with exit status %d" % (cmd[0], rc)
@@ -103,7 +110,7 @@ def _spawn_posix (cmd,
(pid, status) = os.waitpid (pid, 0)
if os.WIFSIGNALED (status):
raise DistutilsExecError, \
- "command %s terminated by signal %d" % \
+ "command '%s' terminated by signal %d" % \
(cmd[0], os.WTERMSIG (status))
elif os.WIFEXITED (status):
@@ -112,7 +119,7 @@ def _spawn_posix (cmd,
return # hey, it succeeded!
else:
raise DistutilsExecError, \
- "command %s failed with exit status %d" % \
+ "command '%s' failed with exit status %d" % \
(cmd[0], exit_status)
elif os.WIFSTOPPED (status):
@@ -120,6 +127,6 @@ def _spawn_posix (cmd,
else:
raise DistutilsExecError, \
- "unknown error executing %s: termination status %d" % \
+ "unknown error executing '%s': termination status %d" % \
(cmd[0], status)
# _spawn_posix ()