Skip to content

Commit d279988

Browse files
authored
fix(workers): prevent ERR_IPC_CHANNEL_CLOSED errors from causing an unhandled exception on TaskRunProcess (#2743)
1 parent 748ae65 commit d279988

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.changeset/lovely-coats-draw.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/core": patch
3+
---
4+
5+
fix: prevent ERR_IPC_CHANNEL_CLOSED errors from causing an unhandled exception on TaskRunProcess

packages/cli-v3/src/executions/taskRunProcess.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ export class TaskRunProcess {
233233
});
234234

235235
this._child.on("exit", this.#handleExit.bind(this));
236+
this._child.on("error", this.#handleError.bind(this));
236237
this._child.stdout?.on("data", this.#handleLog.bind(this));
237238
this._child.stderr?.on("data", this.#handleStdErr.bind(this));
238239

@@ -321,6 +322,10 @@ export class TaskRunProcess {
321322
this._ipc?.send("RESOLVE_WAITPOINT", { waitpoint });
322323
}
323324

325+
#handleError(error: Error) {
326+
logger.debug("child process error", { error, pid: this.pid });
327+
}
328+
324329
async #handleExit(code: number | null, signal: NodeJS.Signals | null) {
325330
logger.debug("handling child exit", { code, signal, pid: this.pid });
326331

0 commit comments

Comments
 (0)