Skip to content

Commit

Permalink
exit with the same exit code as process for railway run (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
coffee-cup authored Mar 24, 2023
1 parent b6c64bc commit 9dd03ba
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,22 @@ pub async fn command(args: Args, _json: bool) -> Result<()> {
// this is for `rails c` and similar REPLs
})?;

tokio::process::Command::new(args.args.first().context("No command provided")?)
.args(args.args[1..].iter())
.envs(variables)
.status()
.await
.context("Failed to spawn command")?;

println!("Looking good? Run `railway up` to deploy your changes!");
let exit_status =
tokio::process::Command::new(args.args.first().context("No command provided")?)
.args(args.args[1..].iter())
.envs(variables)
.status()
.await
.context("Failed to spawn command")?;

if exit_status.success() {
println!("Looking good? Run `railway up` to deploy your changes!");
}

if let Some(code) = exit_status.code() {
// If there is an exit code (process not terminated by signal), exit with that code
std::process::exit(code);
}

Ok(())
}

0 comments on commit 9dd03ba

Please sign in to comment.