summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/spawn.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-07-07 11:11:28 (GMT)
committerGitHub <noreply@github.com>2020-07-07 11:11:28 (GMT)
commit6ae2780be0667a8dc52c4fb583171ec86067d700 (patch)
tree6bbec94ee8c4ea515d767971defd780d601f1bde /Lib/distutils/spawn.py
parent782f44b8fb07ec33cee148b2b6b4cf53024fe0cd (diff)
downloadcpython-6ae2780be0667a8dc52c4fb583171ec86067d700.zip
cpython-6ae2780be0667a8dc52c4fb583171ec86067d700.tar.gz
cpython-6ae2780be0667a8dc52c4fb583171ec86067d700.tar.bz2
bpo-41207 In distutils.spawn, rewrite FileNotFound (GH-21359)
Automerge-Triggered-By: @jaraco
Diffstat (limited to 'Lib/distutils/spawn.py')
-rw-r--r--Lib/distutils/spawn.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/distutils/spawn.py b/Lib/distutils/spawn.py
index aad277b..0d1bd03 100644
--- a/Lib/distutils/spawn.py
+++ b/Lib/distutils/spawn.py
@@ -71,9 +71,15 @@ def spawn(cmd, search_path=1, verbose=0, dry_run=0):
env = dict(os.environ,
MACOSX_DEPLOYMENT_TARGET=cur_target)
- proc = subprocess.Popen(cmd, env=env)
- proc.wait()
- exitcode = proc.returncode
+ try:
+ proc = subprocess.Popen(cmd, env=env)
+ proc.wait()
+ exitcode = proc.returncode
+ except OSError as exc:
+ if not DEBUG:
+ cmd = cmd[0]
+ raise DistutilsExecError(
+ "command %r failed: %s" % (cmd, exc.args[-1])) from exc
if exitcode:
if not DEBUG: