Commit a2daa82
committed
fix: strip ANSI cursor escapes from non-TTY stdout/stderr
ink (via cli-cursor) writes \x1b[?25h to its render stream on App unmount.
The cli-cursor isTTY check was passing because ink's stdout wrapper
inherits isTTY from the underlying stream object, even when stdout is
piped or redirected. The trailing escape corrupted machine-parseable
output for every CLI invocation that captured stdout — most
visibly --json (broke JSON parsing) but also any pipe/redirect
workflow.
Found by the round-2 bug bash (E6) when an agent tried to
`json.load()` the output of `agentcore add interceptor --json` and got
"Extra data" — the bytes after the JSON were the cursor-show escape.
Fix: at the CLI entry, wrap process.stdout and process.stderr writes
to strip \x1b[?25[hl] (cursor show / hide) when the stream is NOT a
TTY. Real TTYs are untouched so interactive terminal behavior — cursor
hiding during spinners, restoring on exit — keeps working.
Verified live with the bundled CLI:
- agentcore --version: ends with newline only, no escape
- agentcore validate: ends with newline only
- agentcore add gateway --json: produces valid JSON, json.load() succeeds1 parent 23877fd commit a2daa82
1 file changed
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
5 | 30 | | |
6 | 31 | | |
7 | 32 | | |
| |||
0 commit comments