fixed pm3 exit code

This commit is contained in:
Djeeberjr 2025-06-05 14:46:33 +02:00
parent 3c1290aec3
commit 6b9ef20187

View File

@ -62,10 +62,15 @@ pub async fn run_pm3(tx: broadcast::Sender<String>) -> 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}"))
}
}