Report subprocess exit code when invocation fails

Issue #192 on hold
Marius Gedminas created an issue

Story: A Jenkins job running tox failed in the 'pip install' step, without a clear error message. After some headscratching I decided to look at dmesg and saw that the server ran out of memory and the OOM killer decided to kill some processes.

Now if tox reported actual exit statuses instead of just saying "invocation failed", I might've seen that pip did not exit with an error code but rather was killed by a signal. That would've been a useful Clue to have.

Comments (5)

  1. Marius Gedminas reporter

    Does this look about right?

    diff -r 69a69d68fc46 tox/
    --- a/tox/   Thu Sep 25 15:43:21 2014 +0200
    +++ b/tox/   Fri Sep 26 15:21:06 2014 +0300
    @@ -95,9 +95,9 @@
                 popen = self._popen(args, cwd, env=env,
                                     stdout=f, stderr=STDOUT)
    -        except OSError:
    -  "invocation failed, args: %s, cwd: %s" %
    -                              (args, cwd))
    +        except OSError as e:
    +  "invocation failed (errno %d), args: %s, cwd: %s" %
    +                              (e.errno, args, cwd))
             popen.outpath = outpath
             popen.args = [str(x) for x in args]
    @@ -118,8 +118,8 @@
             if ret:
                 invoked = " ".join(map(str, popen.args))
                 if outpath:
    -      "invocation failed, logfile: %s" %
    -                                  outpath)
    +      "invocation failed (exit code %d), logfile: %s" %
    +                                  (ret, outpath))
                     out =
                     if hasattr(self, "commandlog"):

    If yes, I'll fix up the tests and submit a proper PR.

  2. Log in to comment