Skip to content

Commit

Permalink
fix(cli): exit with code 1 on error (#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiiBz authored Mar 26, 2023
1 parent c1be2bb commit f2edf38
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/young-shoes-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lagon/cli': patch
---

Exit with code 1 on error
8 changes: 6 additions & 2 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::path::PathBuf;
use std::{path::PathBuf, process::exit};

use clap::{Parser, Subcommand};
use serde::Deserialize;
Expand Down Expand Up @@ -170,13 +170,17 @@ async fn main() {
} => commands::promote(deployment_id, directory).await,
} {
println!("{}", error(&err.to_string()));
exit(1);
}
} else {
match serde_json::from_str(PACKAGE_JSON) {
Ok(PackageJson { version }) => {
println!("{version}");
}
_ => println!("{}", error("Couldn't extract version from package.json")),
_ => {
println!("{}", error("Couldn't extract version from package.json"));
exit(1);
}
}
}
}

0 comments on commit f2edf38

Please sign in to comment.