File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -446,12 +446,21 @@ impl Server {
446
446
res. map_err ( |e| e. into ( ) )
447
447
} ;
448
448
449
- // Install our own SIGINT handler so pending jobs can bail early and
450
- // record server_terminated responses. This gives the client a chance
451
- // to retry the job or build locally.
449
+ // Install our own handlers so pending jobs can bail early and record
450
+ // server_terminated responses. This gives the client a chance to retry
451
+ // the job or build locally.
452
452
let sigint = async {
453
- let _ = tokio:: signal:: ctrl_c ( ) . await ;
454
- tracing:: info!( "Received SIGINT" ) ;
453
+ use tokio:: signal:: unix:: { signal, SignalKind } ;
454
+ let mut sigint = signal ( SignalKind :: interrupt ( ) ) ?;
455
+ let mut sigterm = signal ( SignalKind :: terminate ( ) ) ?;
456
+ futures:: select_biased! {
457
+ _ = sigint. recv( ) . fuse( ) => {
458
+ tracing:: info!( "Received SIGINT" ) ;
459
+ } ,
460
+ _ = sigterm. recv( ) . fuse( ) => {
461
+ tracing:: info!( "Received SIGTERM" ) ;
462
+ } ,
463
+ }
455
464
Ok ( ( ) )
456
465
} ;
457
466
You can’t perform that action at this time.
0 commit comments