mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
fix(upgrade): error instead of panic on unzip failure (#20691)
For #20683
This commit is contained in:
parent
cb154d6afa
commit
91832ce278
1 changed files with 5 additions and 3 deletions
|
@ -491,7 +491,7 @@ pub fn unpack_into_dir(
|
||||||
archive_data: Vec<u8>,
|
archive_data: Vec<u8>,
|
||||||
is_windows: bool,
|
is_windows: bool,
|
||||||
temp_dir: &tempfile::TempDir,
|
temp_dir: &tempfile::TempDir,
|
||||||
) -> Result<PathBuf, std::io::Error> {
|
) -> Result<PathBuf, AnyError> {
|
||||||
const EXE_NAME: &str = "deno";
|
const EXE_NAME: &str = "deno";
|
||||||
let temp_dir_path = temp_dir.path();
|
let temp_dir_path = temp_dir.path();
|
||||||
let exe_ext = if is_windows { "exe" } else { "" };
|
let exe_ext = if is_windows { "exe" } else { "" };
|
||||||
|
@ -557,9 +557,11 @@ pub fn unpack_into_dir(
|
||||||
})?
|
})?
|
||||||
.wait()?
|
.wait()?
|
||||||
}
|
}
|
||||||
ext => panic!("Unsupported archive type: '{ext}'"),
|
ext => bail!("Unsupported archive type: '{ext}'"),
|
||||||
};
|
};
|
||||||
assert!(unpack_status.success());
|
if !unpack_status.success() {
|
||||||
|
bail!("Failed to unpack archive.");
|
||||||
|
}
|
||||||
assert!(exe_path.exists());
|
assert!(exe_path.exists());
|
||||||
fs::remove_file(&archive_path)?;
|
fs::remove_file(&archive_path)?;
|
||||||
Ok(exe_path)
|
Ok(exe_path)
|
||||||
|
|
Loading…
Reference in a new issue