|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
use std::{os::unix::process::CommandExt, process::Command};
|
|
|
|
|
use std::process::Command;
|
|
|
|
|
|
|
|
|
|
use anyhow::Context as _;
|
|
|
|
|
use clap::Parser;
|
|
|
|
@ -57,11 +57,14 @@ pub fn run(opts: Options) -> Result<(), anyhow::Error> {
|
|
|
|
|
args.push(bin_path.as_str());
|
|
|
|
|
args.append(&mut run_args);
|
|
|
|
|
|
|
|
|
|
// spawn the command
|
|
|
|
|
let err = Command::new(args.first().expect("No first argument"))
|
|
|
|
|
// run the command
|
|
|
|
|
let status = Command::new(args.first().expect("No first argument"))
|
|
|
|
|
.args(args.iter().skip(1))
|
|
|
|
|
.exec();
|
|
|
|
|
.status()
|
|
|
|
|
.expect("failed to run the command");
|
|
|
|
|
|
|
|
|
|
// we shouldn't get here unless the command failed to spawn
|
|
|
|
|
Err(anyhow::Error::from(err).context(format!("Failed to run `{}`", args.join(" "))))
|
|
|
|
|
if !status.success() {
|
|
|
|
|
anyhow::bail!("Failed to run `{}`", args.join(" "));
|
|
|
|
|
}
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|