Skip to content

Commit 0d8c38e

Browse files
fix(infra): handle detached respawn child errors
1 parent 612aa1e commit 0d8c38e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/infra/process-respawn.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,8 @@ describe("respawnGatewayProcessForUpdate", () => {
408408
expect(result.mode).toBe("spawned");
409409
expect(result.child).toBe(child);
410410
expect(child.on).toHaveBeenCalledWith("error", expect.any(Function));
411+
const errorListener = child.on.mock.calls.find(([event]) => event === "error")?.[1];
412+
expect(() => errorListener?.(new Error("spawn ENOENT"))).not.toThrow();
411413
expect(child.unref).toHaveBeenCalledOnce();
412414
const onCallOrder = child.on.mock.invocationCallOrder[0] ?? Number.POSITIVE_INFINITY;
413415
const unrefCallOrder = child.unref.mock.invocationCallOrder[0] ?? Number.NEGATIVE_INFINITY;

0 commit comments

Comments
 (0)