





















@@ -183,12 +183,19 @@ describe("enableConsoleCapture", () => {
183183it.each([
184184{ name: "stdout", stream: process.stdout },
185185{ name: "stderr", stream: process.stderr },
186-])("swallows async EPIPE on $name", ({ stream }) => {
187-setLoggerOverride({ level: "info", file: tempLogPath() });
188-enableConsoleCapture();
189-const epipe = new Error("write EPIPE") as NodeJS.ErrnoException;
190-epipe.code = "EPIPE";
191-expect(stream.emit("error", epipe)).toBe(true);
186+])("exits on async EPIPE on $name", ({ stream }) => {
187+const exitSpy = vi.spyOn(process, "exit").mockImplementation((() => {}) as typeof process.exit);
188+try {
189+setLoggerOverride({ level: "info", file: tempLogPath() });
190+loggingState.streamErrorHandlersInstalled = false;
191+enableConsoleCapture();
192+const epipe = new Error("write EPIPE") as NodeJS.ErrnoException;
193+epipe.code = "EPIPE";
194+stream.emit("error", epipe);
195+expect(exitSpy).toHaveBeenCalledWith(0);
196+} finally {
197+exitSpy.mockRestore();
198+}
192199});
193200194201it("rethrows non-EPIPE errors on stdout", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。