-
-
Notifications
You must be signed in to change notification settings - Fork 617
fix: returns 0 exit code on error #1322
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
Conversation
src/main.rs
Outdated
@@ -113,7 +113,7 @@ fn main() -> Result<()> { | |||
|
|||
if !valid_path(&cliargs.repo_path) { | |||
eprintln!("invalid path\nplease run gitui inside of a non-bare git repository"); | |||
return Ok(()); | |||
process::exit(1); |
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.
Did you check if there other places that should return non zero?
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.
did you mean, checking at all potential places for all kinds of errors which should've returned a non-zero exit code ?.Sorry, I haven't. Will do :)
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.
Thanks for tackling this! Wouldn't it be more ideomatic to use return Err(..)
or bail!(...)
here, as main
returns a Result
? I think an error should get turned into exit code 1
automatically.
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.
hey, thanks a lot for the review. I completely agree with you, will update this accordingly. Also, please do let me know, if there are any other places i could potentially look into, would be very grateful. Thanks!
src/main.rs
Outdated
@@ -113,7 +113,7 @@ fn main() -> Result<()> { | |||
|
|||
if !valid_path(&cliargs.repo_path) { | |||
eprintln!("invalid path\nplease run gitui inside of a non-bare git repository"); | |||
return Ok(()); | |||
process::exit(1); |
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.
Thanks for tackling this! Wouldn't it be more ideomatic to use return Err(..)
or bail!(...)
here, as main
returns a Result
? I think an error should get turned into exit code 1
automatically.
Thanks! |
This Pull Request fixes/closes #1315.
It changes the following:
I followed the checklist:
make check
without errors