Skip to content

Commit 76690b4

Browse files
committed
fix(gen): exit process when REPL thread finishes
Without an explicit exit the process hangs because the Bevy window still blocks the main thread after the REPL thread (quit/Ctrl+D/error) joins. Clean up the relay port before terminating to avoid stale locks.
1 parent 5fe847e commit 76690b4

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

crates/gen/src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,16 @@ fn main() -> Result<()> {
998998
tracing::error!("Gen agent loop error: {}", e);
999999
}
10001000
});
1001+
1002+
// REPL exited (/quit, Ctrl+D, or error). The Bevy window is
1003+
// still blocking the main thread, so the process would hang
1004+
// here without an explicit exit. Clean up the relay port
1005+
// (duplicated from the main-thread cleanup below because we
1006+
// won't reach it) and terminate.
1007+
if enable_relay {
1008+
gen3d::mcp_relay::cleanup_relay_port();
1009+
}
1010+
std::process::exit(0);
10011011
});
10021012

10031013
// Run Bevy on the main thread (blocks until window closes)

0 commit comments

Comments
 (0)