Skip to content

Commit

Permalink
Don't panic when cargo contract is not installed. Fix cargo contract…
Browse files Browse the repository at this point in the history
… build command. (#4)

Co-authored-by: Joshy Orndorff <admin@joshyorndorff.com>
  • Loading branch information
pmikolajczyk41 and JoshOrndorff committed Jun 23, 2023
1 parent 87cc082 commit 8056fe6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drink-cli/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ pub fn execute(app_state: &mut AppState) -> Result<()> {
}

fn build_contract(app_state: &mut AppState) {
let output = Command::new("cargo-contract")
let Ok(output) = Command::new("cargo")
.arg("contract")
.arg("build")
.arg("--release")
.output()
.expect("Failed to execute 'cargo contract' command");
.output() else {
app_state.print_error("Failed to execute build command. Make sure `cargo contract` is installed. (`cargo install cargo-contract`)");
return;
};

if output.status.success() {
app_state.print("Contract built successfully");
Expand Down

0 comments on commit 8056fe6

Please sign in to comment.