Skip to content

Commit 29cfefd

Browse files
committed
Fix process-spawn-nonexistent on WSL
If appendWindowsPath is set to true (the default IIRC), running invalid commands returns PermissionDenied instead of NotFound.
1 parent ff693dc commit 29cfefd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/test/ui/process/process-spawn-nonexistent.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ use std::io::ErrorKind;
66
use std::process::Command;
77

88
fn main() {
9-
assert_eq!(Command::new("nonexistent")
10-
.spawn()
11-
.unwrap_err()
12-
.kind(),
13-
ErrorKind::NotFound);
9+
let result = Command::new("nonexistent").spawn().unwrap_err().kind();
10+
11+
assert!(matches!(
12+
result,
13+
// Under WSL with appendWindowsPath=true, this fails with PermissionDenied
14+
ErrorKind::NotFound | ErrorKind::PermissionDenied
15+
));
1416
}

0 commit comments

Comments
 (0)