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 @@ -63,6 +63,7 @@ use fig_util::{
6363} ;
6464use internal:: InternalSubcommand ;
6565use serde:: Serialize ;
66+ use tokio:: signal:: ctrl_c;
6667use tracing:: {
6768 Level ,
6869 debug,
@@ -351,9 +352,20 @@ impl Cli {
351352 cmd. args ( args) ;
352353 }
353354
354- cmd. status ( ) . await ?;
355+ // Because we are spawning chat as a child process, we need the parent process (this one)
356+ // to ignore sigint that are meant for chat (i.e. all of them)
357+ tokio:: spawn ( async move {
358+ loop {
359+ let _ = ctrl_c ( ) . await ;
360+ }
361+ } ) ;
355362
356- Ok ( ExitCode :: SUCCESS )
363+ let exit_status = cmd. status ( ) . await ?;
364+ let exit_code = exit_status
365+ . code ( )
366+ . map_or ( ExitCode :: FAILURE , |e| ExitCode :: from ( e as u8 ) ) ;
367+
368+ Ok ( exit_code)
357369 }
358370
359371 async fn send_telemetry ( & self ) {
You can’t perform that action at this time.
0 commit comments