Skip to content

Commit 22df6cc

Browse files
committed
Fix stdout/stderr pipe breaks during shutdown
1 parent 69d8582 commit 22df6cc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

apps/twig/src/main/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ process.on("SIGINT", () => handleShutdownSignal("SIGINT"));
115115
process.on("SIGHUP", () => handleShutdownSignal("SIGHUP"));
116116

117117
process.on("uncaughtException", (error) => {
118+
if (error.message === "write EIO") {
119+
// stdout/stderr pipe is broken (shutdown). Disable the console transport
120+
// so it stops hitting the broken pipe, then log to file.
121+
log.transports.console.level = false;
122+
log.error("Stdout pipe broken during shutdown (write EIO)");
123+
return;
124+
}
118125
log.error("Uncaught exception", error);
119126
});
120127

0 commit comments

Comments
 (0)