Commit 9c198e9
authored
fix: handle EIO stream errors gracefully in bin.ts (#505)
Fixes [CLI-H2](https://sentry.sentry.io/issues/7347407245/) — an
unhandled `EIO: i/o error, read` that crashed the CLI during `sentry
auth login` on a self-hosted macOS instance.
## Root Cause
The `handleStreamError` function in `bin.ts` only special-cased `EPIPE`
(broken pipe) and re-threw all other errors. When `stdout`/`stderr`
emits an `EIO` error event (non-recoverable I/O failure on the stream
fd), the `throw` inside the synchronous event handler becomes an
uncaught exception — matching the `auto.node.onuncaughtexception`
mechanism seen in the issue.
## Fix
Add `EIO` to the stream error handler allowlist alongside `EPIPE`. Both
are non-recoverable stream errors where the fd is unusable, so the CLI
should exit cleanly rather than crash with a fatal unhandled exception.
`EIO` (errno -5) occurs from low-level I/O failures: terminal device
driver errors, broken PTYs, disk I/O failures on redirected output, or
virtualized storage glitches — common on self-hosted instances.1 parent 830f455 commit 9c198e9
1 file changed
+12
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
13 | 18 | | |
14 | 19 | | |
15 | 20 | | |
16 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
17 | 25 | | |
18 | 26 | | |
19 | 27 | | |
| |||
0 commit comments