Repository navigation
Commit e3dc954
fix: address round-5 cubic finding on #1274 — restoreTTY() was a silent no-op
The round-4 fix for the TTY-descriptor-restoration finding introduced a new
bug of its own: `process.stdout.isTTY` has no OWN property descriptor in
the common case (stdout piped/redirected, which is how it always runs
under a test runner) — Node only sets it as an own property when the
stream genuinely is a TTY. So `ORIGINAL_TTY_DESCRIPTOR` was `undefined` in
virtually every real test run, and `restoreTTY()`'s `if (descriptor)`
guard made it a complete no-op: the property `setTTY()` added stayed
shadowed on `process.stdout` for the rest of the process instead of being
restored, contradicting the comment's stated intent.
Verified empirically (bun -e) before fixing: process.stdout.isTTY genuinely
has no own descriptor and isn't found anywhere on its prototype chain when
not a real TTY. Fixed by deleting the property when there was no original
descriptor to restore. Added a regression test, and confirmed by
temporarily reverting the fix that the test actually fails without it
(not vacuously green).
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JsVwcBQP6VUwqEej3vK2zG1 parent 4c0b0b2 commit e3dc954
1 file changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
32 | 41 | | |
| 42 | + | |
33 | 43 | | |
34 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
35 | 55 | | |
36 | 56 | | |
37 | 57 | | |
| |||
0 commit comments