1
Fork 0

Fix process-spawn-nonexistent on WSL

If appendWindowsPath is set to true (the default IIRC), running invalid
commands returns PermissionDenied instead of NotFound.
This commit is contained in:
Nilstrieb 2022-07-27 13:58:29 +02:00
parent ff693dc7b8
commit 29cfefd355

View file

@ -6,9 +6,11 @@ use std::io::ErrorKind;
use std::process::Command;
fn main() {
assert_eq!(Command::new("nonexistent")
.spawn()
.unwrap_err()
.kind(),
ErrorKind::NotFound);
let result = Command::new("nonexistent").spawn().unwrap_err().kind();
assert!(matches!(
result,
// Under WSL with appendWindowsPath=true, this fails with PermissionDenied
ErrorKind::NotFound | ErrorKind::PermissionDenied
));
}