Closed cmmorrow closed 3 years ago
Can you describe this problem??
Hello @ayush714, I've updated the comment to better describe the problem. Let me know if you have any other questions and thank you for your interest.
After spending some time working on this, I don't like bubbling up the max error code to the CLI. This causes the error code to be unpredictable, where as today, an error code of 1 always indicates a command in a stage failed.
Is your feature request related to a problem? Please describe. Corresponds to the TODO here: https://github.com/cmmorrow/build-magic/blob/main/build_magic/core.py#L160
Describe the solution you'd like Need to bubble up the exit code from the last failing command and make sure it's propagated to the end of the Engine.run() method.
The problem occurs here: https://github.com/cmmorrow/build-magic/blob/main/build_magic/core.py#L436.
If any command fails during stage execution,
self._result
is set to 1 and is returned instead of the exit code from the failing command. The condition whenif any(fails)
is True should be changed to instead setself._result
to the last non-zero exit code infails
.