From 6b9ef20187ff0beba02568be9fb23b0b23b56493 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Thu, 5 Jun 2025 14:46:33 +0200 Subject: [PATCH] fixed pm3 exit code --- src/pm3.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pm3.rs b/src/pm3.rs index fa1a135..2877a8c 100644 --- a/src/pm3.rs +++ b/src/pm3.rs @@ -62,10 +62,15 @@ pub async fn run_pm3(tx: broadcast::Sender) -> Result<()> { }; let status = cmd.wait().await?; - if status.success() { + + // We use the exit code here because status.success() is false if the child was terminated by a + // signal + let code = status.code().unwrap_or(0); + + if code == 0 { Ok(()) } else { - Err(anyhow!("PM3 exited with a non-zero exit code")) + Err(anyhow!("PM3 exited with a non-zero exit code: {code}")) } }