fix(desktop): handle EPIPE errors on stdout/stderr to prevent crash dialog#4213
fix(desktop): handle EPIPE errors on stdout/stderr to prevent crash dialog#4213UtkarshUsername wants to merge 2 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved This is a standard Node.js defensive pattern that handles EPIPE errors on stdout/stderr to prevent crash dialogs when pipes are closed. The 6-line addition is minimal, well-understood, and doesn't affect any business logic. You can customize Macroscope's approvability policy. Learn more. |
What Changed
Added error event listeners on
process.stdoutandprocess.stderrat the very top ofapps/desktop/src/main.ts. These listeners silently swallow EPIPE errors (broken pipe) while re-throwing all other stream errors.Why
When the desktop app is launched from a terminal or parent process with piped stdout/stderr, the pipe can close while the app is still running. Effect's consolePretty logger writes to these streams. Once the pipe is broken, every subsequent write throws EPIPE, which surfaces as an Electron "A JavaScript error occurred in the main process" crash dialog.
Checklist
Note
Low Risk
Small, targeted process-stream hardening with no auth, data, or business-logic changes; non-EPIPE errors still propagate.
Overview
Registers
errorlisteners onprocess.stdoutandprocess.stderrat the very top ofmain.ts(before any imports) so broken-pipe (EPIPE) failures are ignored and every other stream error is still rethrown.This stops unhandled
EPIPEexceptions when the app runs under a terminal or parent that closes its pipe while Effect’sconsolePrettylogger (seeDesktopObservability) keeps writing—those writes previously triggered Electron’s “JavaScript error occurred in the main process” dialog.Reviewed by Cursor Bugbot for commit d84182e. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Ignore EPIPE errors on stdout/stderr to prevent crash dialog in desktop app
Adds error event listeners to
process.stdoutandprocess.stderrin main.ts that silently swallow errors with codeEPIPEand rethrow all others. EPIPE errors occur when a pipe closes before all data is written and previously surfaced as unhandled exceptions, triggering a crash dialog.Macroscope summarized d84182e.