From 6e1b737400742aa2332a30fb937df5fc5af878d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Thu, 16 Feb 2023 20:14:57 +0100 Subject: [PATCH] ref(cli): Add better error message when powershell is missing during upgrade (#17759) Closes https://github.com/denoland/deno/issues/17756 --- cli/tools/upgrade.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs index f6533f6905..b56be5c57e 100644 --- a/cli/tools/upgrade.rs +++ b/cli/tools/upgrade.rs @@ -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