@@ -28,9 +28,9 @@ use tracing::{instrument, trace, trace_span, warn, Instrument};
28
28
use crate :: {
29
29
bincode_input_closed,
30
30
message:: {
31
- CoordinatorMessage , DeleteFileRequest , ExecuteCommandRequest , JobId , Multiplexed ,
32
- OneToOneResponse , ReadFileRequest , ReadFileResponse , SerializedError , WorkerMessage ,
33
- WriteFileRequest ,
31
+ CoordinatorMessage , DeleteFileRequest , ExecuteCommandRequest , ExecuteCommandResponse ,
32
+ JobId , Multiplexed , OneToOneResponse , ReadFileRequest , ReadFileResponse , SerializedError ,
33
+ WorkerMessage , WriteFileRequest ,
34
34
} ,
35
35
DropErrorDetailsExt ,
36
36
} ;
@@ -233,6 +233,7 @@ impl CargoTomlModifier for ExecuteRequest {
233
233
#[ derive( Debug , Clone ) ]
234
234
pub struct ExecuteResponse {
235
235
pub success : bool ,
236
+ pub exit_detail : String ,
236
237
}
237
238
238
239
#[ derive( Debug , Clone ) ]
@@ -338,6 +339,7 @@ impl CargoTomlModifier for CompileRequest {
338
339
#[ derive( Debug , Clone ) ]
339
340
pub struct CompileResponse {
340
341
pub success : bool ,
342
+ pub exit_detail : String ,
341
343
pub code : String ,
342
344
}
343
345
@@ -627,11 +629,17 @@ impl Container {
627
629
. context ( CouldNotStartCargoSnafu ) ?;
628
630
629
631
let task = async move {
630
- let success = task
632
+ let ExecuteCommandResponse {
633
+ success,
634
+ exit_detail,
635
+ } = task
631
636
. await
632
637
. context ( CargoTaskPanickedSnafu ) ?
633
638
. context ( CargoFailedSnafu ) ?;
634
- Ok ( ExecuteResponse { success } )
639
+ Ok ( ExecuteResponse {
640
+ success,
641
+ exit_detail,
642
+ } )
635
643
}
636
644
. boxed ( ) ;
637
645
@@ -693,7 +701,10 @@ impl Container {
693
701
694
702
let commander = self . commander . clone ( ) ;
695
703
let task = async move {
696
- let success = task
704
+ let ExecuteCommandResponse {
705
+ success,
706
+ exit_detail,
707
+ } = task
697
708
. await
698
709
. context ( CargoTaskPanickedSnafu ) ?
699
710
. context ( CargoFailedSnafu ) ?;
@@ -711,7 +722,11 @@ impl Container {
711
722
// TODO: This is synchronous...
712
723
let code = request. postprocess_result ( code) ;
713
724
714
- Ok ( CompileResponse { success, code } )
725
+ Ok ( CompileResponse {
726
+ success,
727
+ exit_detail,
728
+ code,
729
+ } )
715
730
}
716
731
. boxed ( ) ;
717
732
@@ -744,7 +759,7 @@ impl Container {
744
759
745
760
match container_msg {
746
761
WorkerMessage :: ExecuteCommand ( resp) => {
747
- return Ok ( resp. success ) ;
762
+ return Ok ( resp) ;
748
763
}
749
764
WorkerMessage :: StdoutPacket ( packet) => {
750
765
stdout_tx. send ( packet) . await . ok ( /* Receiver gone, that's OK */ ) ;
@@ -869,7 +884,7 @@ pub enum CompileError {
869
884
}
870
885
871
886
struct SpawnCargo {
872
- task : JoinHandle < Result < bool , SpawnCargoError > > ,
887
+ task : JoinHandle < Result < ExecuteCommandResponse , SpawnCargoError > > ,
873
888
stdout_rx : mpsc:: Receiver < String > ,
874
889
stderr_rx : mpsc:: Receiver < String > ,
875
890
}
@@ -2060,6 +2075,31 @@ mod tests {
2060
2075
Ok ( ( ) )
2061
2076
}
2062
2077
2078
+ #[ tokio:: test]
2079
+ #[ snafu:: report]
2080
+ async fn exit_due_to_signal_is_reported ( ) -> Result < ( ) > {
2081
+ let coordinator = new_coordinator ( ) . await ;
2082
+
2083
+ let req = ExecuteRequest {
2084
+ channel : Channel :: Stable ,
2085
+ mode : Mode :: Release ,
2086
+ edition : Edition :: Rust2021 ,
2087
+ crate_type : CrateType :: Binary ,
2088
+ tests : false ,
2089
+ backtrace : false ,
2090
+ code : r#"fn main() { std::process::abort(); }"# . into ( ) ,
2091
+ } ;
2092
+
2093
+ let res = coordinator. execute ( req. clone ( ) ) . await . unwrap ( ) ;
2094
+
2095
+ assert ! ( !res. success) ;
2096
+ assert_contains ! ( res. exit_detail, "abort" ) ;
2097
+
2098
+ coordinator. shutdown ( ) . await ?;
2099
+
2100
+ Ok ( ( ) )
2101
+ }
2102
+
2063
2103
fn new_execution_limited_request ( ) -> ExecuteRequest {
2064
2104
ExecuteRequest {
2065
2105
channel : Channel :: Stable ,
0 commit comments