Skip to content

Commit

Permalink
exit with the code from cargo if we're running a cargo subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
fredszaq committed Jun 27, 2022
1 parent 043563b commit 20983c4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cargo-dinghy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ fn run_command(cli: DinghyCli) -> Result<()> {
platform.setup_env(&project, &setup_args)?;

log::debug!("Launching {:?}", cmd);
cmd.status()?;
let status = cmd.status()?;
log::debug!("done");

Ok(())
std::process::exit(status.code().unwrap_or_else(|| {
log::error!("Could not get cargo exit code");
-1
}));
}
DinghyMode::DinghySubcommand(DinghySubcommand::Runner { ref args }) => {
debug!("starting dinghy runner, args {:?}", args);
Expand Down Expand Up @@ -141,7 +144,6 @@ fn run_command(cli: DinghyCli) -> Result<()> {
} else {
bail!("No device")
}

Ok(())
}
DinghyMode::DinghySubcommand(DinghySubcommand::Devices {}) => {
Expand Down

0 comments on commit 20983c4

Please # to comment.