This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
Improve error reporting in the "try_run" function and correctly include original command output in the error message #153
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kami
commented
Jul 25, 2018
@@ -171,7 +171,7 @@ def check_output(cmd, **popen_args): | |||
process = Popen(cmd, stdout=PIPE, **popen_args) | |||
output, _ = process.communicate() | |||
if process.returncode: | |||
raise CalledProcessError(process.returncode, cmd) | |||
raise CalledProcessError(process.returncode, cmd, output) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constructor signature - https://github.com/enthought/Python-2.7.3/blob/master/Lib/subprocess.py#L408
Any progress on this? We still need to use our fork and not upstream version because this change hasn't been accepted / merged upstream yet. Thanks. |
I'll bring in @thomasrockhu as point of contact for getting this merged. However it seems like appveyor is failing for every build? |
@Kami we are working on getting the |
thomasrockhu
reviewed
Sep 9, 2020
thomasrockhu
approved these changes
Sep 9, 2020
Codecov Report
@@ Coverage Diff @@
## master #153 +/- ##
=====================================
Coverage 88% 88%
=====================================
Files 2 2
Lines 9 9
=====================================
Hits 8 8
Misses 1 1 |
Thank you for this @Kami! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
This pull request fixes
check_output
function to correctly include output of the command which ran in theCalledProcessError
exception which is thrown.In addition to that, it also includes return (exit) code in the printed error message.
Before this change it was very hard / impossible to debug various codecove command failures because the original command output was not included in the error which is printed to the console.
Before (as you can see, output is always
None
which makes troubleshooting practically impossible):After (command output is correctly included which makes troubleshooting possible / easier):