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 crate::runner::CaptureError;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use runner::CapturedOutput;
|
use runner::CapturedOutput;
|
||||||
|
use std::process::exit;
|
||||||
|
|
||||||
mod quote;
|
mod quote;
|
||||||
mod runner;
|
mod runner;
|
||||||
|
@ -210,7 +211,13 @@ async fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
match request.send().await.and_then(|r| r.error_for_status()) {
|
match request.send().await.and_then(|r| r.error_for_status()) {
|
||||||
Ok(_) => (),
|
Ok(_) => exit(match status {
|
||||||
Err(error) => eprintln!("Failed to send request to ntfy: {}", error),
|
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