File tree Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -11,27 +11,32 @@ pub fn spawn_detached(command: &mut process::Command) -> io::Result<()> {
1111 unsafe {
1212 use std:: os:: unix:: process:: CommandExt as _;
1313
14- command. pre_exec ( move || {
15- match libc:: fork ( ) {
16- -1 => return Err ( io:: Error :: last_os_error ( ) ) ,
17- 0 => ( ) ,
18- _ => libc:: _exit ( 0 ) ,
19- }
14+ command
15+ . pre_exec ( move || {
16+ match libc:: fork ( ) {
17+ -1 => return Err ( io:: Error :: last_os_error ( ) ) ,
18+ 0 => ( ) ,
19+ _ => libc:: _exit ( 0 ) ,
20+ }
2021
21- if libc:: setsid ( ) == -1 {
22- return Err ( io:: Error :: last_os_error ( ) ) ;
23- }
22+ if libc:: setsid ( ) == -1 {
23+ return Err ( io:: Error :: last_os_error ( ) ) ;
24+ }
2425
25- Ok ( ( ) )
26- } ) ;
26+ Ok ( ( ) )
27+ } )
28+ . spawn ( ) ?
29+ . wait ( )
30+ . map ( |_| ( ) )
2731 }
2832 #[ cfg( windows) ]
2933 {
3034 use std:: os:: windows:: process:: CommandExt ;
3135 const CREATE_NEW_PROCESS_GROUP : u32 = 0x00000200 ;
3236 const CREATE_NO_WINDOW : u32 = 0x08000000 ;
33- command. creation_flags ( CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW ) ;
37+ command
38+ . creation_flags ( CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW )
39+ . spawn ( )
40+ . map ( |_| ( ) )
3441 }
35-
36- command. spawn ( ) . map ( |_| ( ) )
3742}
You can’t perform that action at this time.
0 commit comments