Repository navigation
fix: preserve stderr during JLine installation - #13387
efegokdemir wants to merge 1 commit into
Conversation
JLine's AnsiConsole wraps both standard streams around the terminal output, which sends stderr through stdout in Maven's terminal setup. Restore the original standard error stream after installation and uninstallation, and cover the stream preservation with a regression test.
This comment has been minimized.
This comment has been minimized.
gnodet-bot
left a comment
There was a problem hiding this comment.
LGTM. The fix is correct: capturing System.err before AnsiConsole.systemInstall() runs on the background thread and restoring it in a finally block cleanly solves the stream-redirection bug. Concurrency model is sound — the systemErr field write happens-before the read in doSystemUninstall() via the CompletableFuture chain. The defensive restore in doSystemUninstall() is belt-and-suspenders against class-loading-order edge cases and does no harm. Pre-fix test validation confirmed: test fails without the fix, passes with it.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
Closing in favour of the upstream JLine fix. The root cause has been addressed in JLine 4.4.8 via jline/jline3#2317 — |
Fixes #13380.
AnsiConsole.systemInstall()wraps both standard streams around the terminal output. Maven attaches that terminal to stdout, so-Dorg.slf4j.simpleLogger.logFile=System.errstill sent logs to stdout.Keep the original stderr stream after JLine installs its wrappers and restore it again during uninstall. The regression test checks that both installation and cleanup preserve stderr.
Tests
mvn -pl maven-embedder,maven-jline -Dtest=MavenCliTest,MessageUtilsTest -Dsurefire.failIfNoSpecifiedTests=false -am test— passed (19 tests).mvn -Prun-its verify— passed. The 3.10.x branch has norun-itsprofile, so this ran the full default verify lifecycle without the separate Core IT suite.mvn -pl apache-maven -am -DskipTests package— passed.mvn -pl maven-jline spotless:checkandgit diff --check— passed.System.errbecame JLine'sAnsiPrintStream; it passes with this change. A packaged CLI run now sends 593 bytes to stderr and none to stdout with the property, while default logging remains on stdout.Checklist
mvn verifyto make sure basic checks pass.