mirror of
https://github.com/denoland/deno.git
synced 2025-01-07 06:46:59 -05:00
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
This commit is contained in:
parent
3f7207d1a9
commit
f5243f1dbd
1 changed files with 7 additions and 22 deletions
|
@ -481,7 +481,7 @@ async fn download_package(
|
||||||
match maybe_bytes {
|
match maybe_bytes {
|
||||||
Some(bytes) => Ok(bytes),
|
Some(bytes) => Ok(bytes),
|
||||||
None => {
|
None => {
|
||||||
log::info!("Download could not be found, aborting");
|
log::error!("Download could not be found, aborting");
|
||||||
std::process::exit(1)
|
std::process::exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -506,32 +506,17 @@ pub fn unpack_into_dir(
|
||||||
let unpack_status = match archive_ext {
|
let unpack_status = match archive_ext {
|
||||||
"zip" if cfg!(windows) => {
|
"zip" if cfg!(windows) => {
|
||||||
fs::write(&archive_path, &archive_data)?;
|
fs::write(&archive_path, &archive_data)?;
|
||||||
Command::new("powershell.exe")
|
Command::new("tar.exe")
|
||||||
.arg("-NoLogo")
|
.arg("xf")
|
||||||
.arg("-NoProfile")
|
.arg(&archive_path)
|
||||||
.arg("-NonInteractive")
|
.arg("-C")
|
||||||
.arg("-Command")
|
.arg(temp_dir_path)
|
||||||
.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()))
|
|
||||||
.spawn()
|
.spawn()
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
if err.kind() == std::io::ErrorKind::NotFound {
|
if err.kind() == std::io::ErrorKind::NotFound {
|
||||||
std::io::Error::new(
|
std::io::Error::new(
|
||||||
std::io::ErrorKind::NotFound,
|
std::io::ErrorKind::NotFound,
|
||||||
"`powershell.exe` was not found in your PATH",
|
"`tar.exe` was not found in your PATH",
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
err
|
err
|
||||||
|
|
Loading…
Reference in a new issue