Skip to content

Commit

Permalink
return nonsuccessful status code on failed build (FuelLabs#539)
Browse files Browse the repository at this point in the history
* return nonsuccessful status code on failed build

* fmt

* fix forc build return type
  • Loading branch information
sezna authored Dec 30, 2021
1 parent 9dc167b commit 2c4ae1e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
4 changes: 1 addition & 3 deletions forc/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,5 @@ pub(crate) async fn run_cli() -> Result<(), String> {
Forc::Update(command) => update::exec(command).await,
Forc::JsonAbi(command) => json_abi::exec(command),
Forc::Lsp(command) => lsp::exec(command).await,
}?;

Ok(())
}
}
8 changes: 2 additions & 6 deletions forc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ mod ops;
mod utils;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + 'static>> {
match cli::run_cli().await {
Ok(_) => (),
Err(e) => println!("Error: {}", e),
};
Ok(())
async fn main() -> Result<(), String> {
cli::run_cli().await
}
8 changes: 4 additions & 4 deletions forc/src/ops/forc_fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ fn format_after_build(command: FormatCommand) -> Result<(), FormatError> {
if command.check {
if contains_edits {
// One or more files are not formatted, exit with error
std::process::exit(1);
Err("Files contain formatting violations.".into())
} else {
// All files are formatted, exit cleanly
std::process::exit(0);
Ok(())
}
} else {
Ok(())
}

Ok(())
}
_ => Err("Manifest file does not exist".into()),
}
Expand Down

0 comments on commit 2c4ae1e

Please sign in to comment.