diff options
author | Andrey Filatkin <anfilat@mail.ru> | 2020-06-29 16:13:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-29 09:13:07 -0400 |
commit | a690a206790778cf63df876fdeefebc17607e5c8 (patch) | |
tree | aad22e26c7c68217737c2eda4d5054f29a620291 | |
parent | db36857288609858ada259444509a31637980ce3 (diff) |
fix(cli/upgrade): upgrade fails on Windows with space in temp path (#6522)
-rw-r--r-- | cli/tests/integration_tests.rs | 21 | ||||
-rw-r--r-- | cli/upgrade.rs | 4 |
2 files changed, 23 insertions, 2 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 8f29d8307..6f8299c92 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -421,6 +421,27 @@ fn upgrade_in_tmpdir() { // Warning: this test requires internet access. #[test] +fn upgrade_with_space_in_path() { + let temp_dir = tempfile::Builder::new() + .prefix("directory with spaces") + .tempdir() + .unwrap(); + let exe_path = temp_dir.path().join("deno"); + let _ = std::fs::copy(util::deno_exe_path(), &exe_path).unwrap(); + assert!(exe_path.exists()); + let status = Command::new(&exe_path) + .arg("upgrade") + .arg("--force") + .env("TMP", temp_dir.path()) + .spawn() + .unwrap() + .wait() + .unwrap(); + assert!(status.success()); +} + +// Warning: this test requires internet access. +#[test] fn upgrade_with_version_in_tmpdir() { let temp_dir = TempDir::new().unwrap(); let exe_path = if cfg!(windows) { diff --git a/cli/upgrade.rs b/cli/upgrade.rs index 9779e067a..f840dc4c5 100644 --- a/cli/upgrade.rs +++ b/cli/upgrade.rs @@ -204,9 +204,9 @@ fn unpack(archive_data: Vec<u8>) -> Result<PathBuf, ErrBox> { }", ) .arg("-Path") - .arg(&archive_path) + .arg(format!("'{}'", &archive_path.to_str().unwrap())) .arg("-DestinationPath") - .arg(&temp_dir) + .arg(format!("'{}'", &temp_dir.to_str().unwrap())) .spawn()? .wait()? } |