Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report subprocess exit code when invocation fails #192

Closed
pytoxbot opened this issue Sep 17, 2016 · 3 comments
Closed

Report subprocess exit code when invocation fails #192

pytoxbot opened this issue Sep 17, 2016 · 3 comments

Comments

@pytoxbot
Copy link

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.

@pytoxbot
Copy link
Author

Original comment by @hpk42

Report subprocess exit code when invocation fails

Fixes #192

→ <<cset 25efae2240bf>>

@pytoxbot
Copy link
Author

Original comment by @mgedmin

Does this look about right?

diff -r 69a69d68fc46 tox/_cmdline.py
--- a/tox/_cmdline.py   Thu Sep 25 15:43:21 2014 +0200
+++ b/tox/_cmdline.py   Fri Sep 26 15:21:06 2014 +0300
@@ -95,9 +95,9 @@
         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 @@
         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"):

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

@pytoxbot
Copy link
Author

Original comment by @hpk42

Agreed, care to submit a PR?

@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant