-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: failing cargo shuttle deploy returns successful exit code (#166)
* fix: return shell error code when `cargo shuttle deploy` results in deployment failure * feat: return error code for failed deployment with `cargo status` and `delete` also * refactor: use new `CommandOutcome` type instead of `DeploymentStateMeta` * tests: update Co-authored-by: chesedo <pieter@chesedo.me>
- Loading branch information
Showing
6 changed files
with
81 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
use anyhow::Result; | ||
use cargo_shuttle::{Args, Shuttle}; | ||
use cargo_shuttle::{Args, CommandOutcome, Shuttle}; | ||
use structopt::StructOpt; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
env_logger::init(); | ||
Shuttle::new().run(Args::from_args()).await | ||
|
||
let result = Shuttle::new().run(Args::from_args()).await; | ||
|
||
if matches!(result, Ok(CommandOutcome::DeploymentFailure)) { | ||
// Deployment failure results in a shell error exit code being returned (this allows | ||
// chaining of commands with `&&` for example to fail at the first deployment failure). | ||
std::process::exit(1); // TODO: use `std::process::ExitCode::FAILURE` once stable. | ||
} | ||
|
||
result.map(|_| ()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters