File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ use super :: prelude:: * ;
2+
3+ #[ derive( Clone , Debug , Default ) ]
4+ pub struct FlagSpy {
5+ pub flags : Arc < AtomicU32 > ,
6+ }
7+
8+ impl StdCommandWrapper for FlagSpy {
9+ fn pre_spawn ( & mut self , command : & mut Command , core : & StdCommandWrap ) -> Result < ( ) > {
10+ #[ cfg( feature = "creation-flags" ) ]
11+ if let Some ( CreationFlags ( user_flags) ) = core. get_wrap :: < CreationFlags > ( ) {
12+ self . flags . set ( * user_flags) ;
13+ }
14+
15+ Ok ( ( ) )
16+ }
17+ }
18+
19+ #[ test]
20+ fn empty_flags_input ( ) -> Result < ( ) > {
21+ let spy = FlagSpy :: default ( ) ;
22+ let _ = StdCommandWrap :: with_new ( "powershell.exe" , |command| {
23+ command. arg ( "/C" ) . arg ( "echo hello" ) . stdout ( Stdio :: piped ( ) ) ;
24+ } )
25+ . wrap ( CreationFlags ( CREATE_NO_WINDOW ) )
26+ . wrap ( spy. clone ( ) )
27+ . spawn ( ) ?;
28+
29+ assert_eq ! ( spy. flags. get( ) , CREATE_NO_WINDOW ) ;
30+
31+ Ok ( ( ) )
32+ }
You can’t perform that action at this time.
0 commit comments