diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 072f5eb..396c66a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,11 @@ // TODO: Log levels -use std::{path::PathBuf, process::Stdio, rc::Rc}; +use std::{ + path::PathBuf, + process::{ExitStatus, Stdio}, + rc::Rc, +}; use anyhow::Context; use rumqttc::{Event::Incoming, Packet, Publish, QoS}; @@ -13,7 +17,7 @@ mod config; const PROGRAM: &str = "mqttr"; -async fn run(program: &[String], message: &Publish) -> anyhow::Result<()> { +async fn run(program: &[String], message: &Publish) -> anyhow::Result<ExitStatus> { let mut command = Command::new(&program[0]); command .args(&program[1..]) @@ -28,8 +32,8 @@ async fn run(program: &[String], message: &Publish) -> anyhow::Result<()> { let mut stdin = proc.stdin.take().context("No stdin")?; stdin.write_all(&message.payload).await?; drop(stdin); - println!("{}", proc.wait().await?); - Ok(()) + let result = proc.wait().await?; + Ok(result) } fn topic_match(filter: &str, topic: &str) -> bool { |