tui: exit cleanly without hanging after session ends
- Force process exit after TUI thread completes to prevent lingering processes - Add 5-second timeout to worker shutdown to prevent indefinite hangs during cleanup
This commit is contained in:
parent
5512231ca8
commit
ad3c192837
2 changed files with 7 additions and 1 deletions
|
|
@ -184,5 +184,6 @@ export const TuiThreadCommand = cmd({
|
||||||
} finally {
|
} finally {
|
||||||
unguard?.()
|
unguard?.()
|
||||||
}
|
}
|
||||||
|
process.exit(0)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,12 @@ export const rpc = {
|
||||||
async shutdown() {
|
async shutdown() {
|
||||||
Log.Default.info("worker shutting down")
|
Log.Default.info("worker shutting down")
|
||||||
if (eventStream.abort) eventStream.abort.abort()
|
if (eventStream.abort) eventStream.abort.abort()
|
||||||
await Instance.disposeAll()
|
await Promise.race([
|
||||||
|
Instance.disposeAll(),
|
||||||
|
new Promise((resolve) => {
|
||||||
|
setTimeout(resolve, 5000)
|
||||||
|
}),
|
||||||
|
])
|
||||||
if (server) server.stop(true)
|
if (server) server.stop(true)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue