diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 8f29d83070..6f8299c924 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -419,6 +419,27 @@ fn upgrade_in_tmpdir() { // TODO(ry) assert!(mtime1 < mtime2); } +// 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() { diff --git a/cli/upgrade.rs b/cli/upgrade.rs index 9779e067a7..f840dc4c52 100644 --- a/cli/upgrade.rs +++ b/cli/upgrade.rs @@ -204,9 +204,9 @@ fn unpack(archive_data: Vec) -> Result { }", ) .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()? }