File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ use fig_util::{
6666} ;
6767use internal:: InternalSubcommand ;
6868use serde:: Serialize ;
69+ use tokio:: signal:: ctrl_c;
6970use tracing:: {
7071 Level ,
7172 debug,
@@ -367,9 +368,20 @@ impl Cli {
367368 cmd. args ( args) ;
368369 }
369370
370- cmd. status ( ) . await ?;
371+ // Because we are spawning chat as a child process, we need the parent process (this one)
372+ // to ignore sigint that are meant for chat (i.e. all of them)
373+ tokio:: spawn ( async move {
374+ loop {
375+ let _ = ctrl_c ( ) . await ;
376+ }
377+ } ) ;
371378
372- Ok ( ExitCode :: SUCCESS )
379+ let exit_status = cmd. status ( ) . await ?;
380+ let exit_code = exit_status
381+ . code ( )
382+ . map_or ( ExitCode :: FAILURE , |e| ExitCode :: from ( e as u8 ) ) ;
383+
384+ Ok ( exit_code)
373385 }
374386
375387 async fn send_telemetry ( & self ) {
You can’t perform that action at this time.
0 commit comments