contracts-fixtures: Do not assume that rustup is installed (#2586)

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`.
This commit is contained in:
Bastian Köcher
2023-12-04 17:03:47 +01:00
committed by GitHub
parent 01bbd63d2d
commit aa4754e30a
+4 -4
View File
@@ -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(())
}
@@ -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")
}