bootstrapper update corruption check

This commit is contained in:
sdhEmily 2023-11-01 14:24:54 +00:00
parent 35b9172a6a
commit fb9bafa3b3
2 changed files with 13 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "syntax_bootstrapper" name = "syntax_bootstrapper"
version = "1.2.0" version = "1.2.1"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # 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 // Run the latest bootstrapper ( with the same arguments passed to us ) and exit
#[cfg(target_os = "windows")] #[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.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"))] #[cfg(not(target_os = "windows"))]
{ {