Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

fix: exit cleanly when ShutdownComplete is received (#1864)

Michael Bolinafa8f0d6177a
diff --git a/codex-rs/exec/src/lib.rs b/codex-rs/exec/src/lib.rs
index 288b6177e5..06df2aebca 100644
--- a/codex-rs/exec/src/lib.rs
+++ b/codex-rs/exec/src/lib.rs
@@ -216,10 +216,16 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
res = codex.next_event() => match res {
Ok(event) => {
debug!("Received event: {event:?}");
+
+ let is_shutdown_complete = matches!(event.msg, EventMsg::ShutdownComplete);
if let Err(e) = tx.send(event) {
error!("Error sending event: {e:?}");
break;
}
+ if is_shutdown_complete {
+ info!("Received shutdown event, exiting event loop.");
+ break;
+ }
},
Err(e) => {
error!("Error receiving event: {e:?}");