From badbed7115dc6de2207b95f1fd1e7c3fddeced37 Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Fri, 26 Sep 2014 15:39:24 +0300 Subject: Report subprocess exit code when invocation fails Fixes #192 --- tests/test_z_cmdline.py | 2 +- tox/_cmdline.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index 283c993..57aba64 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -200,7 +200,7 @@ def test_run_custom_install_command_error(cmd, initproj): }) result = cmd.run("tox") result.stdout.fnmatch_lines([ - "ERROR: invocation failed, args: ['*/tox.ini*", + "ERROR: invocation failed (errno 13), args: ['*/tox.ini*", ]) assert result.ret diff --git a/tox/_cmdline.py b/tox/_cmdline.py index aed71ec..0df2f17 100644 --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -95,9 +95,9 @@ class Action(object): try: popen = self._popen(args, cwd, env=env, stdout=f, stderr=STDOUT) - except OSError: - self.report.error("invocation failed, args: %s, cwd: %s" % - (args, cwd)) + except OSError as e: + self.report.error("invocation failed (errno %d), args: %s, cwd: %s" % + (e.errno, args, cwd)) raise popen.outpath = outpath popen.args = [str(x) for x in args] @@ -118,8 +118,8 @@ class Action(object): if ret: invoked = " ".join(map(str, popen.args)) if outpath: - self.report.error("invocation failed, logfile: %s" % - outpath) + self.report.error("invocation failed (exit code %d), logfile: %s" % + (ret, outpath)) out = outpath.read() self.report.error(out) if hasattr(self, "commandlog"): -- cgit v1.2.1