diff --git a/agents/src/ipc/supervised_proc.ts b/agents/src/ipc/supervised_proc.ts index ec2e0ff76..18eae162e 100644 --- a/agents/src/ipc/supervised_proc.ts +++ b/agents/src/ipc/supervised_proc.ts @@ -229,6 +229,15 @@ export abstract class SupervisedProc { } this.#closing = true; + if (!this.init.done) { + this.init.reject(new Error('process closed before initialization completed')); + this.proc?.kill(); + await this.#join.await.then(() => { + this.clearTimers(); + }); + return; + } + if (this.proc?.connected) { this.proc.send({ case: 'shutdownRequest' }); }