fix(cli): harden launcher lifecycle

This commit is contained in:
Turtle
2026-07-30 11:14:18 +08:00
parent 93748e5b47
commit cd100a81f1
4 changed files with 19 additions and 21 deletions

View File

@@ -1676,7 +1676,9 @@ export function apply(ctx: Context, config: Config): void {
initialSkill === undefined ? {} : { initialSkill },
), {
terminal: new ProcessTerminal(),
exit: code => process.exit(code),
exit: (code) => {
void ctx.fiber.dispose().finally(() => { process.exit(code) })
},
...resumeHost === undefined ? {} : { handoffResume: (sessionId, cwd) => resumeHost.handoff(sessionId, cwd) },
...goodbyeMessage === undefined ? {} : { goodbyeMessage },
})