jamesfredley commented on PR #15694:
URL: https://github.com/apache/grails-core/pull/15694#issuecomment-4724083095
The `withJansi=false` change is correct and doesn't cost us colors on
Mac/Linux - I checked the Spring Boot 4 source to be sure.
Colors come from Spring Boot's `%clr` converter
(`AnsiOutput`/`ColorConverter`), which the template already uses via
`${CONSOLE_LOG_PATTERN}`. That path is completely independent of Jansi:
- In a real terminal, `%clr` colors render on Mac/Linux whether `withJansi`
is true or false - the terminal interprets ANSI natively. Jansi only ever
mattered for legacy Windows consoles.
- Under `./gradlew bootRun`, `System.console()` is null, so `AnsiOutput`'s
DETECT mode emits no colors *regardless of Jansi*. So the old `withJansi=true`
gave us no colors under `bootRun` anyway - it only added the DevTools landmine.
So we lose nothing by dropping Jansi, and we can keep the Mac/Linux colors -
by convention, even under `bootRun` - the proper way. Pushed a follow-up commit
that adds this to the generated `build.gradle`:
```groovy
tasks.matching { it.name == 'bootRun' }.configureEach {
systemProperty 'spring.output.ansi.console-available', 'true'
}
```
`spring.output.ansi.console-available=true` tells Spring Boot's `AnsiOutput`
to make the per-OS decision at runtime: colors on Linux/macOS and modern
Windows terminals, and automatically off on legacy Windows consoles (no raw
escape codes). It's scoped to `bootRun` so it never leaks ANSI into prod/CI
logs, and it has none of Jansi's global `System.out` state - so no DevTools
restart breakage on any platform. Net effect: better colors on Mac/Linux than
the old Jansi toggle ever delivered, with the Windows landmine gone.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]