diff options
| author | Chris Denton <christophersdenton@gmail.com> | 2022-03-23 04:51:26 +0000 |
|---|---|---|
| committer | Chris Denton <christophersdenton@gmail.com> | 2022-03-23 05:33:44 +0000 |
| commit | 9270ca193f58d287d75f0115c59667792cec1e19 (patch) | |
| tree | d0a509a56e2eeccf88d9a2805d9dc0766447415e /library/std/src/process | |
| parent | 23320a2f8314a929020ea08b2e8d9e45116cf7d5 (diff) | |
| download | rust-9270ca193f58d287d75f0115c59667792cec1e19.tar.gz rust-9270ca193f58d287d75f0115c59667792cec1e19.zip | |
Add test for issue #95178
Diffstat (limited to 'library/std/src/process')
| -rw-r--r-- | library/std/src/process/tests.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs index 4f779ab4e78..955ad68916c 100644 --- a/library/std/src/process/tests.rs +++ b/library/std/src/process/tests.rs @@ -435,3 +435,24 @@ fn run_bat_script() { assert!(output.status.success()); assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "Hello, fellow Rustaceans!"); } + +// See issue #95178 +#[test] +#[cfg(windows)] +fn run_canonical_bat_script() { + let tempdir = crate::sys_common::io::test::tmpdir(); + let script_path = tempdir.join("hello.cmd"); + + crate::fs::write(&script_path, "@echo Hello, %~1!").unwrap(); + + // Try using a canonical path + let output = Command::new(&script_path.canonicalize().unwrap()) + .arg("fellow Rustaceans") + .stdout(crate::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(output.status.success()); + assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "Hello, fellow Rustaceans!"); +} |
