fix(subprocess): prioritize host-exit cleanup listener

This commit is contained in:
pku-xht
2026-08-11 23:46:16 +08:00
parent 84b15efd85
commit 0c232cf5b8
2 changed files with 18 additions and 1 deletions

View File

@@ -48,7 +48,7 @@ export class LocalSubprocessService extends SubprocessService {
super(ctx)
ctx.effect(() => {
const onHostExit = (): void => { this.terminateForHostExit() }
process.on('exit', onHostExit)
process.prependListener('exit', onHostExit)
return async () => {
try {
await this.disposeManagedProcesses()