remove check_run function from helpers

This commit is contained in:
bit-aloo 2025-06-14 17:10:56 +05:30
parent b5db059b83
commit c9eeeb4b5f
No known key found for this signature in database
3 changed files with 9 additions and 27 deletions

View file

@ -1379,7 +1379,7 @@ impl Config {
.run_always()
.args(["submodule", "-q", "sync"])
.arg(relative_path)
.run(&self);
.run(self);
// Try passing `--progress` to start, then run git again without if that fails.
let update = |progress: bool| {
@ -1408,23 +1408,23 @@ impl Config {
git.arg(relative_path);
git
};
if !update(true).allow_failure().run(&self) {
update(false).allow_failure().run(&self);
if !update(true).allow_failure().run(self) {
update(false).allow_failure().run(self);
}
// Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).
// diff-index reports the modifications through the exit status
let has_local_modifications =
!submodule_git().allow_failure().args(["diff-index", "--quiet", "HEAD"]).run(&self);
!submodule_git().allow_failure().args(["diff-index", "--quiet", "HEAD"]).run(self);
if has_local_modifications {
submodule_git().allow_failure().args(["stash", "push"]).run(&self);
submodule_git().allow_failure().args(["stash", "push"]).run(self);
}
submodule_git().allow_failure().args(["reset", "-q", "--hard"]).run(&self);
submodule_git().allow_failure().args(["clean", "-qdfx"]).run(&self);
submodule_git().allow_failure().args(["reset", "-q", "--hard"]).run(self);
submodule_git().allow_failure().args(["clean", "-qdfx"]).run(self);
if has_local_modifications {
submodule_git().allow_failure().args(["stash", "pop"]).run(&self);
submodule_git().allow_failure().args(["stash", "pop"]).run(self);
}
}

View file

@ -244,7 +244,7 @@ impl Config {
curl.arg("--retry-all-errors");
}
curl.arg(url);
if !curl.run(&self) {
if !curl.run(self) {
if self.host_target.contains("windows-msvc") {
eprintln!("Fallback to PowerShell");
for _ in 0..3 {

View file

@ -270,24 +270,6 @@ pub fn is_valid_test_suite_arg<'a, P: AsRef<Path>>(
}
}
// FIXME: get rid of this function
pub fn check_run(cmd: &mut BootstrapCommand, print_cmd_on_fail: bool) -> bool {
let status = match cmd.as_command_mut().status() {
Ok(status) => status,
Err(e) => {
println!("failed to execute command: {cmd:?}\nERROR: {e}");
return false;
}
};
if !status.success() && print_cmd_on_fail {
println!(
"\n\ncommand did not execute successfully: {cmd:?}\n\
expected success, got: {status}\n\n"
);
}
status.success()
}
pub fn make(host: &str) -> PathBuf {
if host.contains("dragonfly")
|| host.contains("freebsd")