mirror of
https://github.com/quantum5/ntfy-run.git
synced 2025-04-24 05:31:58 -04:00
Forward child process return code if possible
This commit is contained in:
parent
ffb1c1c8b5
commit
7e74fc8888
11
src/main.rs
11
src/main.rs
|
@ -1,6 +1,7 @@
|
|||
use crate::runner::CaptureError;
|
||||
use clap::Parser;
|
||||
use runner::CapturedOutput;
|
||||
use std::process::exit;
|
||||
|
||||
mod quote;
|
||||
mod runner;
|
||||
|
@ -210,7 +211,13 @@ async fn main() {
|
|||
};
|
||||
|
||||
match request.send().await.and_then(|r| r.error_for_status()) {
|
||||
Ok(_) => (),
|
||||
Err(error) => eprintln!("Failed to send request to ntfy: {}", error),
|
||||
Ok(_) => exit(match status {
|
||||
Some(code) => code.code().unwrap_or(255),
|
||||
None => 255,
|
||||
}),
|
||||
Err(error) => {
|
||||
eprintln!("Failed to send request to ntfy: {}", error);
|
||||
exit(37)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue