diff --git a/Cargo.toml b/Cargo.toml index 8411d0d..525585c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/src/main.rs b/src/main.rs index 8206b9e..bf6a159 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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"))] {