Merge pull request #1 from sdhEmily/corruption_check

bootstrapper update corruption check
This commit is contained in:
PrintedScript 2023-11-01 22:40:52 +08:00 committed by GitHub
commit ea35090634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "syntax_bootstrapper"
version = "1.2.0"
version = "1.2.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -247,9 +247,19 @@ async fn main() {
// Run the latest bootstrapper ( with the same arguments passed to us ) and exit
#[cfg(target_os = "windows")]
{
let mut command = std::process::Command::new(latest_bootstrapper_path);
let mut command = std::process::Command::new(latest_bootstrapper_path.clone());
command.args(&args[1..]);
command.spawn().unwrap();
match command.spawn() {
Ok(_) => {},
Err(e) => {
debug(&format!("Bootstrapper errored with error {}", e));
info("Found bootstrapper was corrupted! Downloading...");
std::fs::remove_file(latest_bootstrapper_path.clone()).unwrap();
download_file(&http_client, &format!("https://{}/{}-{}", setup_url, latest_client_version, bootstrapper_filename), &latest_bootstrapper_path).await;
command.spawn().expect("Bootstrapper is still corrupted.");
std::thread::sleep(std::time::Duration::from_secs(20));
}
}
}
#[cfg(not(target_os = "windows"))]
{