diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-09-27 17:57:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-27 17:57:58 -0400 |
commit | 35fad4d2bc022b7053b5390ec1fb47ca28f4086e (patch) | |
tree | 75a332d11c3e48ab25a3a43def78ad90befed223 /cli/tools | |
parent | 31991e221bd6e2d32016bdd2595ee668e8456c35 (diff) |
fix(upgrade): use tar.exe to extract on Windows (#20711)
This is what we do for deno install, so it should be fine here
https://github.com/denoland/deno_install/pull/219
Closes https://github.com/denoland/deno/issues/20683
Diffstat (limited to 'cli/tools')
-rw-r--r-- | cli/tools/upgrade.rs | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs index 366cc7fc4..04332f5df 100644 --- a/cli/tools/upgrade.rs +++ b/cli/tools/upgrade.rs @@ -481,7 +481,7 @@ async fn download_package( match maybe_bytes { Some(bytes) => Ok(bytes), None => { - log::info!("Download could not be found, aborting"); + log::error!("Download could not be found, aborting"); std::process::exit(1) } } @@ -506,32 +506,17 @@ pub fn unpack_into_dir( let unpack_status = match archive_ext { "zip" if cfg!(windows) => { fs::write(&archive_path, &archive_data)?; - Command::new("powershell.exe") - .arg("-NoLogo") - .arg("-NoProfile") - .arg("-NonInteractive") - .arg("-Command") - .arg( - "& { - param($Path, $DestinationPath) - trap { $host.ui.WriteErrorLine($_.Exception); exit 1 } - Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::ExtractToDirectory( - $Path, - $DestinationPath - ); - }", - ) - .arg("-Path") - .arg(format!("'{}'", &archive_path.to_str().unwrap())) - .arg("-DestinationPath") - .arg(format!("'{}'", &temp_dir_path.to_str().unwrap())) + Command::new("tar.exe") + .arg("xf") + .arg(&archive_path) + .arg("-C") + .arg(temp_dir_path) .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", + "`tar.exe` was not found in your PATH", ) } else { err |