diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2020-07-05 16:38:15 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-07-05 16:38:15 -0400 |
commit | f321d201defaa81697be66ed53edc58eb037132b (patch) | |
tree | 5a009792a12f636e76fc66af6a41ef45630b4960 /setuptools | |
parent | e7e5817e442b01cb199bfc75c7098fb198fdc3ba (diff) | |
parent | 7aa5abeafc1e0b1b351c4c8ac7eb14c310366a46 (diff) | |
download | external_python_setuptools-f321d201defaa81697be66ed53edc58eb037132b.tar.gz external_python_setuptools-f321d201defaa81697be66ed53edc58eb037132b.tar.bz2 external_python_setuptools-f321d201defaa81697be66ed53edc58eb037132b.zip |
Merge https://github.com/pypa/distutils into HEAD
Diffstat (limited to 'setuptools')
-rw-r--r-- | setuptools/_distutils/spawn.py | 12 | ||||
-rw-r--r-- | setuptools/_distutils/tests/test_spawn.py | 5 |
2 files changed, 14 insertions, 3 deletions
diff --git a/setuptools/_distutils/spawn.py b/setuptools/_distutils/spawn.py index aad277b0..0d1bd039 100644 --- a/setuptools/_distutils/spawn.py +++ b/setuptools/_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: diff --git a/setuptools/_distutils/tests/test_spawn.py b/setuptools/_distutils/tests/test_spawn.py index 919d0ad9..704019a1 100644 --- a/setuptools/_distutils/tests/test_spawn.py +++ b/setuptools/_distutils/tests/test_spawn.py @@ -126,6 +126,11 @@ class SpawnTestCase(support.TempdirManager, rv = find_executable(program) self.assertEqual(rv, filename) + def test_spawn_missing_exe(self): + with self.assertRaises(DistutilsExecError) as ctx: + spawn(['does-not-exist']) + assert 'command does-no-exist failed' in str(ctx) + def test_suite(): return unittest.makeSuite(SpawnTestCase) |