File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -435,3 +435,24 @@ fn run_bat_script() {
435
435
assert ! ( output. status. success( ) ) ;
436
436
assert_eq ! ( String :: from_utf8_lossy( & output. stdout) . trim( ) , "Hello, fellow Rustaceans!" ) ;
437
437
}
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
+ }
You can’t perform that action at this time.
0 commit comments