@@ -9,8 +9,8 @@ use std::{
99 process:: { ChildStderr , ChildStdout , Command , Stdio } ,
1010} ;
1111
12- use command_group:: { CommandGroup , GroupChild } ;
1312use crossbeam_channel:: Sender ;
13+ use process_wrap:: std:: { StdChildWrapper , StdCommandWrap } ;
1414use stdx:: process:: streaming_output;
1515
1616/// Cargo output is structured as a one JSON per line. This trait abstracts parsing one line of
@@ -85,7 +85,7 @@ impl<T: ParseFromLine> CargoActor<T> {
8585 }
8686}
8787
88- struct JodGroupChild ( GroupChild ) ;
88+ struct JodGroupChild ( Box < dyn StdChildWrapper > ) ;
8989
9090impl Drop for JodGroupChild {
9191 fn drop ( & mut self ) {
@@ -119,14 +119,20 @@ impl<T> fmt::Debug for CommandHandle<T> {
119119impl < T : ParseFromLine > CommandHandle < T > {
120120 pub ( crate ) fn spawn ( mut command : Command , sender : Sender < T > ) -> std:: io:: Result < Self > {
121121 command. stdout ( Stdio :: piped ( ) ) . stderr ( Stdio :: piped ( ) ) . stdin ( Stdio :: null ( ) ) ;
122- let mut child = command. group_spawn ( ) . map ( JodGroupChild ) ?;
123122
124123 let program = command. get_program ( ) . into ( ) ;
125124 let arguments = command. get_args ( ) . map ( |arg| arg. into ( ) ) . collect :: < Vec < OsString > > ( ) ;
126125 let current_dir = command. get_current_dir ( ) . map ( |arg| arg. to_path_buf ( ) ) ;
127126
128- let stdout = child. 0 . inner ( ) . stdout . take ( ) . unwrap ( ) ;
129- let stderr = child. 0 . inner ( ) . stderr . take ( ) . unwrap ( ) ;
127+ let mut child = StdCommandWrap :: from ( command) ;
128+ #[ cfg( unix) ]
129+ child. wrap ( process_wrap:: std:: ProcessSession ) ;
130+ #[ cfg( windows) ]
131+ child. wrap ( process_wrap:: std:: JobObject ) ;
132+ let mut child = child. spawn ( ) . map ( JodGroupChild ) ?;
133+
134+ let stdout = child. 0 . stdout ( ) . take ( ) . unwrap ( ) ;
135+ let stderr = child. 0 . stderr ( ) . take ( ) . unwrap ( ) ;
130136
131137 let actor = CargoActor :: < T > :: new ( sender, stdout, stderr) ;
132138 let thread = stdx:: thread:: Builder :: new ( stdx:: thread:: ThreadIntent :: Worker )
0 commit comments