-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Description
Currently, shutdown
always returns 0
as exit code:
abscissa/core/src/application.rs
Lines 160 to 169 in 31bdced
/// Shut down this application gracefully, exiting with success. | |
fn shutdown(&self, shutdown: Shutdown) -> ! { | |
let components = self.state().components(); | |
if let Err(e) = components.shutdown(self, shutdown) { | |
fatal_error(self, &e) | |
} | |
process::exit(0); | |
} |
As a user of abscissa
I would expect the following to return a non-zero exit code, when I pass Shutdown::Crash
, though.
if let Err(err) = self.inner_run() {
status_err!("{}", err);
APP.shutdown(Shutdown::Crash);
};
What's the opinion on changing that, to allow non-zero exit codes? We could directly return and call process::exit()
ourselves, for sure. I'm unsure, though, whether it wouldn't be nice to stay within abscissa
to let all the other components shutting down gracefully, while still exiting with a non-zero exit code.
EDIT:
Maybe utilizing https://docs.rs/exitcode/1.1.2/exitcode/ these numbers?
/// Shut down this application gracefully, exiting with your given `exit_code`.
fn shutdown_with_exit_code(&self, shutdown: Shutdown, exit_code: i32) -> ! {
let components = self.state().components();
if let Err(e) = components.shutdown(self, shutdown) {
fatal_error(self, &e)
};
process::exit(exit_code);
}
Metadata
Metadata
Assignees
Labels
No labels