Skip to content

Commit

Permalink
Merge pull request #820 from richerfu/master
Browse files Browse the repository at this point in the history
feat: Out more error info with cmd run failed
  • Loading branch information
epage authored Oct 7, 2024
2 parents 562cb3a + 7552906 commit 094b393
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ops/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,17 @@ fn do_call(
}
}

let ctx_dir = match path {
Some(p) => format!(" within {}", p.display()),
None => String::new(),
};

let mut child = cmd
.spawn()
.map_err(|e| anyhow::format_err!("failed to launch `{cmd_name}`: {e}"))?;
.map_err(|e| anyhow::format_err!("failed to launch `{cmd_name}`{ctx_dir}: {e}"))?;
let result = child
.wait()
.map_err(|e| anyhow::format_err!("failed to launch `{cmd_name}`: {e}"))?;
.map_err(|e| anyhow::format_err!("failed to launch `{cmd_name}`{ctx_dir}: {e}"))?;

Ok(result.success())
}
Expand Down

0 comments on commit 094b393

Please sign in to comment.