ref(cli): Add better error message when powershell is missing during upgrade (#17759)

Closes https://github.com/denoland/deno/issues/17756
This commit is contained in:
Kamil Ogórek 2023-02-16 20:14:57 +01:00 committed by GitHub
parent 0aeb8bc759
commit 6e1b737400
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -511,7 +511,17 @@ pub fn unpack_into_dir(
.arg(format!("'{}'", &archive_path.to_str().unwrap()))
.arg("-DestinationPath")
.arg(format!("'{}'", &temp_dir_path.to_str().unwrap()))
.spawn()?
.spawn()
.map_err(|err| {
if err.kind() == std::io::ErrorKind::NotFound {
std::io::Error::new(
std::io::ErrorKind::NotFound,
"`powershell.exe` was not found in your PATH",
)
} else {
err
}
})?
.wait()?
}
"zip" => {
@ -524,7 +534,7 @@ pub fn unpack_into_dir(
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`",
"`unzip` was not found in your PATH, please install `unzip`",
)
} else {
err