Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir authored Jul 3, 2024
1 parent 841143d commit ddde984
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions crates/nsis-process/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,21 @@ mod tests {
fn spawn_cmd() {
unsafe { run_as_user("cmd", "/c timeout 3") };
}

#[test]
fn spawn_with_spaces() {
let current = std::env::current_dir().unwrap();

let dir = current.join("dir space");
std::fs::create_dir_all(dir).unwrap();

let systemroot = std::env::var("SYSTEMROOT").unwrap_or("C:\\Windows");

let cmd = format!("{systemroot}\\System32\\cmd.exe");
let cmd_out = dir.join("cmdout.exe");

std::fs::copy(cmd, cmd_out).unwrap();

unsafe { run_as_user(cmd_out.display().to_string().as_str(), "/c timeout 3") };
}
}

0 comments on commit ddde984

Please sign in to comment.