File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ // Test that windows `creation_flags` extension to `Command` works.
2+
3+ //@ run-pass
4+ //@ only-windows
5+ //@ needs-subprocess
6+
7+ use std:: process:: Command ;
8+ use std:: { env, fs} ;
9+
10+ fn main ( ) {
11+ if env:: args ( ) . skip ( 1 ) . any ( |s| s == "--child" ) {
12+ child ( ) ;
13+ } else {
14+ parent ( ) ;
15+ }
16+ }
17+
18+ fn parent ( ) {
19+ let exe = env:: current_exe ( ) . unwrap ( ) ;
20+ let dir = env:: current_dir ( ) . unwrap ( ) ;
21+ let status = Command :: new ( & exe)
22+ . arg ( "--child" )
23+ . current_dir ( fs:: canonicalize ( dir) . unwrap ( ) )
24+ . spawn ( )
25+ . unwrap ( )
26+ . wait ( )
27+ . unwrap ( ) ;
28+ assert_eq ! ( status. code( ) , Some ( 0 ) ) ;
29+ }
30+
31+ fn child ( ) {
32+ let current_dir = env:: current_dir ( ) . unwrap ( ) ;
33+ let current_dir = current_dir. as_os_str ( ) . as_encoded_bytes ( ) ;
34+ assert ! ( !current_dir. starts_with( br"\\?\" ) ) ;
35+ }
You can’t perform that action at this time.
0 commit comments