Skip to content

Commit

Permalink
contracts-fixtures: Do not assume that rustup is installed (#2586)
Browse files Browse the repository at this point in the history
The build script was assuming that `rustup` is installed, which breaks
the build on systems that do not use `rustup`. This pull request just
fixes it by not panicking on the call to `rustup`.
  • Loading branch information
bkchr committed Dec 4, 2023
1 parent 01bbd63 commit aa4754e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions substrate/frame/contracts/fixtures/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@ fn invoke_cargo_fmt<'a>(
if !Command::new("rustup")
.args(&["run", "nightly", "rustfmt", "--version"])
.output()
.expect("failed to execute process")
.status
.success()
.map_or(false, |o| o.status.success())
{
return Ok(())
}
Expand All @@ -169,10 +167,12 @@ fn invoke_cargo_fmt<'a>(
let stderr = String::from_utf8_lossy(&fmt_res.stderr);
eprintln!("{}\n{}", stdout, stderr);
eprintln!(
"Fixtures files are not formatted.\nPlease run `rustup run nightly rustfmt --config-path {} {}/*.rs`",
"Fixtures files are not formatted.\n
Please run `rustup run nightly rustfmt --config-path {} {}/*.rs`",
config_path.display(),
contract_dir.display()
);

anyhow::bail!("Fixtures files are not formatted")
}

Expand Down

0 comments on commit aa4754e

Please sign in to comment.