-
Notifications
You must be signed in to change notification settings - Fork 164
fix: Handle exit code success #150
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
fix: Handle exit code success #150
Conversation
|
Reviewing this today. Do you have a command for me to check that this PR works? |
jasonslagter
left a comment
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.
Need
|
swaroop-osec
left a comment
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.
- Please bump the crate version in
Cargo.tomlto"0.4.4" - It would be great to run
cargo clippyand apply suggestions to keep the codebase clean and idiomatic. - Consider adding more descriptive error messages to the
ensure!macros. This will improve debugging and make logs clear.
|
@Arrowana This works well as intended, verified locally. Requested a few minor changes to polish it up. |
|
lgtm |
| use anyhow::anyhow; | ||
| use anyhow::{anyhow, ensure}; | ||
| use api::{ | ||
| get_last_deployed_slot, get_remote_job, get_remote_status, send_job_with_uploader_to_remote, |
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.
.
Problem
The API of Command looks misunderstood, it does not err on exit code not being a success but only if invocation of the command itself fails (command not found...).
This leads to messed up CLI output, one has to read what happened above to deduce the actual real outcome of the command since it continues on failure silently.
A typical case is compilation failure then a program hash gets printed.
I think this can be more serious in some cases where a sequence of actions can lead to garbage unrelated hash in silence.
Solution
Unfortunately there is no direct api it seems to err on status code. Use ensure! macro to validate the success
I didn't use the status code on anything that looks like a cleanup to avoid a failure and further cleanup