Commit 8cc4249
Fix #11885: Disable ANSI colors when stdout is piped or redirected on JDK 22+
Change ForcedSysOut to SysOut so that JLine properly checks whether
stdout is a TTY before creating a system terminal. ForcedSysOut
bypasses this check, which causes JLine to create a non-dumb terminal
even when stdout is piped (since stdin is still a TTY), resulting in
ANSI escape codes appearing in piped output on JDK 22+ where the FFM
provider successfully creates a terminal from stdin alone.
With SysOut, JLine detects that stdout is not a TTY and falls back to
a dumb terminal, correctly disabling ANSI colors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent ed79e94 commit 8cc4249
1 file changed
Lines changed: 3 additions & 5 deletions
Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | | - | |
| 345 | + | |
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
| 357 | + | |
358 | 358 | | |
359 | | - | |
| 359 | + | |
360 | 360 | | |
361 | | - | |
362 | | - | |
363 | 361 | | |
364 | 362 | | |
365 | 363 | | |
| |||
0 commit comments