@@ -10,11 +10,12 @@ use std::{
10
10
time:: Duration ,
11
11
} ;
12
12
13
+ use command_group:: { CommandGroup , GroupChild } ;
13
14
use crossbeam_channel:: { never, select, unbounded, Receiver , Sender } ;
14
15
use paths:: AbsPathBuf ;
15
16
use rustc_hash:: FxHashMap ;
16
17
use serde:: Deserialize ;
17
- use stdx:: { process:: streaming_output, JodChild } ;
18
+ use stdx:: process:: streaming_output;
18
19
19
20
pub use cargo_metadata:: diagnostic:: {
20
21
Applicability , Diagnostic , DiagnosticCode , DiagnosticLevel , DiagnosticSpan ,
@@ -39,7 +40,7 @@ pub enum InvocationLocation {
39
40
pub enum FlycheckConfig {
40
41
CargoCommand {
41
42
command : String ,
42
- target_triple : Option < String > ,
43
+ target_triples : Vec < String > ,
43
44
all_targets : bool ,
44
45
no_default_features : bool ,
45
46
all_features : bool ,
@@ -285,7 +286,7 @@ impl FlycheckActor {
285
286
let ( mut cmd, args) = match & self . config {
286
287
FlycheckConfig :: CargoCommand {
287
288
command,
288
- target_triple ,
289
+ target_triples ,
289
290
no_default_features,
290
291
all_targets,
291
292
all_features,
@@ -299,7 +300,7 @@ impl FlycheckActor {
299
300
cmd. args ( & [ "--workspace" , "--message-format=json" , "--manifest-path" ] )
300
301
. arg ( self . root . join ( "Cargo.toml" ) . as_os_str ( ) ) ;
301
302
302
- if let Some ( target) = target_triple {
303
+ for target in target_triples {
303
304
cmd. args ( & [ "--target" , target. as_str ( ) ] ) ;
304
305
}
305
306
if * all_targets {
@@ -359,10 +360,12 @@ impl FlycheckActor {
359
360
}
360
361
}
361
362
363
+ struct JodChild ( GroupChild ) ;
364
+
362
365
/// A handle to a cargo process used for fly-checking.
363
366
struct CargoHandle {
364
367
/// The handle to the actual cargo process. As we cannot cancel directly from with
365
- /// a read syscall dropping and therefor terminating the process is our best option.
368
+ /// a read syscall dropping and therefore terminating the process is our best option.
366
369
child : JodChild ,
367
370
thread : jod_thread:: JoinHandle < io:: Result < ( bool , String ) > > ,
368
371
receiver : Receiver < CargoMessage > ,
@@ -371,10 +374,10 @@ struct CargoHandle {
371
374
impl CargoHandle {
372
375
fn spawn ( mut command : Command ) -> std:: io:: Result < CargoHandle > {
373
376
command. stdout ( Stdio :: piped ( ) ) . stderr ( Stdio :: piped ( ) ) . stdin ( Stdio :: null ( ) ) ;
374
- let mut child = JodChild :: spawn ( command) ?;
377
+ let mut child = command. group_spawn ( ) . map ( JodChild ) ?;
375
378
376
- let stdout = child. stdout . take ( ) . unwrap ( ) ;
377
- let stderr = child. stderr . take ( ) . unwrap ( ) ;
379
+ let stdout = child. 0 . inner ( ) . stdout . take ( ) . unwrap ( ) ;
380
+ let stderr = child. 0 . inner ( ) . stderr . take ( ) . unwrap ( ) ;
378
381
379
382
let ( sender, receiver) = unbounded ( ) ;
380
383
let actor = CargoActor :: new ( sender, stdout, stderr) ;
@@ -386,13 +389,13 @@ impl CargoHandle {
386
389
}
387
390
388
391
fn cancel ( mut self ) {
389
- let _ = self . child . kill ( ) ;
390
- let _ = self . child . wait ( ) ;
392
+ let _ = self . child . 0 . kill ( ) ;
393
+ let _ = self . child . 0 . wait ( ) ;
391
394
}
392
395
393
396
fn join ( mut self ) -> io:: Result < ( ) > {
394
- let _ = self . child . kill ( ) ;
395
- let exit_status = self . child . wait ( ) ?;
397
+ let _ = self . child . 0 . kill ( ) ;
398
+ let exit_status = self . child . 0 . wait ( ) ?;
396
399
let ( read_at_least_one_message, error) = self . thread . join ( ) ?;
397
400
if read_at_least_one_message || exit_status. success ( ) {
398
401
Ok ( ( ) )
0 commit comments