@@ -9,8 +9,8 @@ use std::{
9
9
process:: { ChildStderr , ChildStdout , Command , Stdio } ,
10
10
} ;
11
11
12
- use command_group:: { CommandGroup , GroupChild } ;
13
12
use crossbeam_channel:: Sender ;
13
+ use process_wrap:: std:: { StdChildWrapper , StdCommandWrap } ;
14
14
use stdx:: process:: streaming_output;
15
15
16
16
/// 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> {
85
85
}
86
86
}
87
87
88
- struct JodGroupChild ( GroupChild ) ;
88
+ struct JodGroupChild ( Box < dyn StdChildWrapper > ) ;
89
89
90
90
impl Drop for JodGroupChild {
91
91
fn drop ( & mut self ) {
@@ -119,14 +119,20 @@ impl<T> fmt::Debug for CommandHandle<T> {
119
119
impl < T : ParseFromLine > CommandHandle < T > {
120
120
pub ( crate ) fn spawn ( mut command : Command , sender : Sender < T > ) -> std:: io:: Result < Self > {
121
121
command. stdout ( Stdio :: piped ( ) ) . stderr ( Stdio :: piped ( ) ) . stdin ( Stdio :: null ( ) ) ;
122
- let mut child = command. group_spawn ( ) . map ( JodGroupChild ) ?;
123
122
124
123
let program = command. get_program ( ) . into ( ) ;
125
124
let arguments = command. get_args ( ) . map ( |arg| arg. into ( ) ) . collect :: < Vec < OsString > > ( ) ;
126
125
let current_dir = command. get_current_dir ( ) . map ( |arg| arg. to_path_buf ( ) ) ;
127
126
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 ( ) ;
130
136
131
137
let actor = CargoActor :: < T > :: new ( sender, stdout, stderr) ;
132
138
let thread = stdx:: thread:: Builder :: new ( stdx:: thread:: ThreadIntent :: Worker )
0 commit comments