1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00

fix(cli/upgrade): upgrade fails on Windows with space in temp path (#6522)

This commit is contained in:
Andrey Filatkin 2020-06-29 16:13:07 +03:00 committed by GitHub
parent db36857288
commit a690a20679
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View file

@ -419,6 +419,27 @@ fn upgrade_in_tmpdir() {
// TODO(ry) assert!(mtime1 < mtime2); // 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. // Warning: this test requires internet access.
#[test] #[test]
fn upgrade_with_version_in_tmpdir() { fn upgrade_with_version_in_tmpdir() {

View file

@ -204,9 +204,9 @@ fn unpack(archive_data: Vec<u8>) -> Result<PathBuf, ErrBox> {
}", }",
) )
.arg("-Path") .arg("-Path")
.arg(&archive_path) .arg(format!("'{}'", &archive_path.to_str().unwrap()))
.arg("-DestinationPath") .arg("-DestinationPath")
.arg(&temp_dir) .arg(format!("'{}'", &temp_dir.to_str().unwrap()))
.spawn()? .spawn()?
.wait()? .wait()?
} }