Skip to content

fix(desktop): handle EPIPE errors on stdout/stderr to prevent crash dialog#4213

Open
UtkarshUsername wants to merge 2 commits into
pingdotgg:mainfrom
UtkarshUsername:fix/desktop-epipe-pipe-handling
Open

fix(desktop): handle EPIPE errors on stdout/stderr to prevent crash dialog#4213
UtkarshUsername wants to merge 2 commits into
pingdotgg:mainfrom
UtkarshUsername:fix/desktop-epipe-pipe-handling

Conversation

@UtkarshUsername

@UtkarshUsername UtkarshUsername commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What Changed

Added error event listeners on process.stdout and process.stderr at the very top of apps/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.

image

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Low Risk
Small, targeted process-stream hardening with no auth, data, or business-logic changes; non-EPIPE errors still propagate.

Overview
Registers error listeners on process.stdout and process.stderr at the very top of main.ts (before any imports) so broken-pipe (EPIPE) failures are ignored and every other stream error is still rethrown.

This stops unhandled EPIPE exceptions when the app runs under a terminal or parent that closes its pipe while Effect’s consolePretty logger (see DesktopObservability) 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.stdout and process.stderr in main.ts that silently swallow errors with code EPIPE and 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.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7897797a-3b85-4605-a97b-43786fc425b6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Jul 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant