Skip to content

Commit

Permalink
Replace OSError with DistutilsExecError. Fixes #3 and pypa/setuptools…
Browse files Browse the repository at this point in the history
…#2228 and bpo-41207.
  • Loading branch information
jaraco committed Jul 5, 2020
1 parent ff8c5a8 commit f2e4b91
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions distutils/spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f2e4b91

Please sign in to comment.