Skip to content

Fix main-process crash from stream logging errors#266

Merged
dimavedenyapin merged 1 commit intomainfrom
fix/nonfatal-stream-errors
Apr 23, 2026
Merged

Fix main-process crash from stream logging errors#266
dimavedenyapin merged 1 commit intomainfrom
fix/nonfatal-stream-errors

Conversation

@dimavedenyapin
Copy link
Copy Markdown
Contributor

Summary

  • replace throwing stdout/stderr error handlers with non-throwing process stream handlers
  • ignore both EPIPE and EIO stream errors, since diagnostic stream failures must not crash the app
  • harden crash logger console writes so logging failures cannot throw during global crash/rejection handling

RCA

The macOS crash report showed Node aborting from PromiseRejectCallback -> OnFatalError -> abort(). The vulnerable path was an unhandled rejection being logged through console.error while stderr emitted EIO. The old stderr handler threw for every non-EPIPE error, so EIO during rejection handling escalated into Node's fatal path.

Verification

  • pnpm test:main src/main/process-stream-errors.test.ts
  • pnpm typecheck
  • pre-commit hook: lint, typecheck, build, full test suite (85 files, 1247 tests passed)

@dimavedenyapin dimavedenyapin merged commit 71261c1 into main Apr 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant