mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
fix(cli/upgrade): nice error when unzip is missing (#12693)
Previously just a generic "error: No such file or directory (os error 2)" was printed. Now "`unzip` was not found on your PATH, please install `unzip`" will be printed.
This commit is contained in:
parent
f5eb177f50
commit
22dd1b90c4
1 changed files with 13 additions and 2 deletions
|
@ -2,7 +2,8 @@
|
|||
|
||||
//! This module provides feature to upgrade deno executable
|
||||
|
||||
use deno_core::error::{bail, AnyError};
|
||||
use deno_core::error::bail;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::futures::StreamExt;
|
||||
use deno_runtime::deno_fetch::reqwest;
|
||||
use deno_runtime::deno_fetch::reqwest::Client;
|
||||
|
@ -262,7 +263,17 @@ pub fn unpack(
|
|||
Command::new("unzip")
|
||||
.current_dir(&temp_dir)
|
||||
.arg(archive_path)
|
||||
.spawn()?
|
||||
.spawn()
|
||||
.map_err(|err| {
|
||||
if err.kind() == std::io::ErrorKind::NotFound {
|
||||
std::io::Error::new(
|
||||
std::io::ErrorKind::NotFound,
|
||||
"`unzip` was not found on your PATH, please install `unzip`",
|
||||
)
|
||||
} else {
|
||||
err
|
||||
}
|
||||
})?
|
||||
.wait()?
|
||||
}
|
||||
ext => panic!("Unsupported archive type: '{}'", ext),
|
||||
|
|
Loading…
Add table
Reference in a new issue