From a6ebabda68ee587072efc23cd903edcc397dfafa Mon Sep 17 00:00:00 2001 From: Harshit Singh Bhandari Date: Tue, 23 Jun 2026 01:17:21 +0530 Subject: [PATCH] fix(desktop): swallow EPIPE on std streams (Windows GUI launch crash) On Windows Squirrel/GUI launches there is no attached console, so process.stdout/stderr are dead pipes. The daemon-output console.log/error calls failed with EPIPE and, lacking an error listener, crashed the main process with 'A JavaScript error occurred in the main process'. Add an error listener that ignores broken-pipe writes. Co-Authored-By: Claude Opus 4.8 --- frontend/src/main.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 597282c51..b0ef62ab8 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -36,6 +36,17 @@ import { createBrowserViewHost, type BrowserViewHost } from "./main/browser-view declare const MAIN_WINDOW_VITE_DEV_SERVER_URL: string | undefined; declare const MAIN_WINDOW_VITE_NAME: string; +// Windows GUI/Squirrel launches have no attached console, so process.stdout and +// process.stderr are dead pipes. The daemon-output console.log/console.error calls +// below then fail with EPIPE, and with no "error" listener that surfaces as an +// uncaught exception that crashes the main process. Swallow broken-pipe write +// errors on the std streams: a dropped log line is harmless, the crash is not. +const ignoreStdStreamError = (err: NodeJS.ErrnoException): void => { + if (err.code === "EPIPE") return; +}; +process.stdout.on("error", ignoreStdStreamError); +process.stderr.on("error", ignoreStdStreamError); + // Must run before app ready so the About panel and default-menu role labels use it. app.setName("Agent Orchestrator");