diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2020-07-07 11:11:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-07 11:11:28 (GMT) |
commit | 6ae2780be0667a8dc52c4fb583171ec86067d700 (patch) | |
tree | 6bbec94ee8c4ea515d767971defd780d601f1bde /Lib/distutils/spawn.py | |
parent | 782f44b8fb07ec33cee148b2b6b4cf53024fe0cd (diff) | |
download | cpython-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.py | 12 |
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: |