Skip to content

Commit 9270ca1

Browse files
committed
Add test for issue #95178
1 parent 23320a2 commit 9270ca1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

library/std/src/process/tests.rs

+21
Original file line numberDiff line numberDiff line change
@@ -435,3 +435,24 @@ fn run_bat_script() {
435435
assert!(output.status.success());
436436
assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "Hello, fellow Rustaceans!");
437437
}
438+
439+
// See issue #95178
440+
#[test]
441+
#[cfg(windows)]
442+
fn run_canonical_bat_script() {
443+
let tempdir = crate::sys_common::io::test::tmpdir();
444+
let script_path = tempdir.join("hello.cmd");
445+
446+
crate::fs::write(&script_path, "@echo Hello, %~1!").unwrap();
447+
448+
// Try using a canonical path
449+
let output = Command::new(&script_path.canonicalize().unwrap())
450+
.arg("fellow Rustaceans")
451+
.stdout(crate::process::Stdio::piped())
452+
.spawn()
453+
.unwrap()
454+
.wait_with_output()
455+
.unwrap();
456+
assert!(output.status.success());
457+
assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "Hello, fellow Rustaceans!");
458+
}

0 commit comments

Comments
 (0)