Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion rust/src/platform_dirs/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ fn actual_home_lookup_preserves_environment_and_passwd_fallback() {
Some(" ".into()),
Some(OsString::from_vec(b"/home/\xff".to_vec())),
] {
let mut child = std::process::Command::new(std::env::current_exe().unwrap());
let mut child = std::process::Command::new(
std::env::current_exe().expect("resolve current test executable"),
);
child
.current_dir(std::env::temp_dir())
.args(["--exact", test, "--nocapture"])
Expand Down
24 changes: 13 additions & 11 deletions rust/src/platform_dirs/windows/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,19 @@ fn public_windows_lookups_match_the_os_known_folders() {

const CREATE_NO_WINDOW: u32 = 0x0800_0000;
let current = std::thread::current();
let output = std::process::Command::new(std::env::current_exe().unwrap())
.current_dir(std::env::temp_dir())
.creation_flags(CREATE_NO_WINDOW)
.args(["--exact", current.name().expect("test name"), "--nocapture"])
.env(CHILD, "1")
.env("LOCALAPPDATA", "Z:\\not-the-local-known-folder")
.env("APPDATA", "Z:\\not-the-roaming-known-folder")
.env("USERPROFILE", "Z:\\not-the-profile-known-folder")
.env("HOME", "Z:\\not-the-home-folder")
.output()
.expect("run known-folder lookup with spoofed environment");
let output = std::process::Command::new(
std::env::current_exe().expect("resolve current test executable"),
)
.current_dir(std::env::temp_dir())
.creation_flags(CREATE_NO_WINDOW)
.args(["--exact", current.name().expect("test name"), "--nocapture"])
.env(CHILD, "1")
.env("LOCALAPPDATA", "Z:\\not-the-local-known-folder")
.env("APPDATA", "Z:\\not-the-roaming-known-folder")
.env("USERPROFILE", "Z:\\not-the-profile-known-folder")
.env("HOME", "Z:\\not-the-home-folder")
.output()
.expect("run known-folder lookup with spoofed environment");
assert!(
output.status.success() && String::from_utf8_lossy(&output.stdout).contains("1 passed"),
"{}{}",
Expand Down
Loading