CyberNativeAI commented on issue #13380:
URL: https://github.com/apache/maven/issues/13380#issuecomment-6064280334

   Reproduced on 3.10.0 vs 3.9.16 (Apache binary tarballs, sha512 verified; 
Temurin 21.0.12, linux/amd64, Docker), with stdout and stderr captured 
separately.
   
   `mvn -Dorg.slf4j.simpleLogger.logFile=System.err validate`: 3.9.16 gives 
stdout 0 B / stderr 572 B; 3.10.0 gives stdout 572 B / stderr 0 B, identical to 
a run without the property. Same with stdout as a pipe or a file.
   
   It is not only the logger. Under 3.10.0, `System.err.println` from an 
`exec:java` main class also lands on fd 1, although `/proc/self/fd/2` is still 
the real stderr. In both versions System.out and System.err are Ansi print 
streams. In 3.10.0 (`org.jline.jansi.AnsiConsole`) both are built from 
`Terminal.output()`, and `MavenCli.main` -> `MessageUtils.systemInstall()` 
builds that terminal with `systemOutput(SysOut)`. I read this from the shipped 
bytecode; I did not patch Maven.
   
   Workarounds on 3.10.0 that keep Maven's own log off stdout (10/10 runs each, 
stdout pipe and file): `-Dorg.slf4j.simpleLogger.logFile=/dev/stderr` (also via 
MAVEN_OPTS), `-B`, `--color=never`, and `-q` (drops INFO/WARNING). `-B` and 
`--color=never` skip the `MessageUtils.getTerminal()` call in the default 
`auto` branch of `MavenCli.logging()`. That fits the data; I did not instrument 
it.
   
   No tested workaround restores direct `System.err` writes to fd 2. These had 
no effect: `-Djline.terminal.type=dumb`, `-Dorg.jline.terminal.type=dumb`, 
`-Dorg.jline.terminal.output=err|forced-err`, 
`-Dorg.jline.terminal.providers=dumb`, `-Djansi.mode=strip`. In the bytecode, 
`TerminalBuilder.computeSystemOutput()` only reads `org.jline.terminal.output` 
when the builder's value is null.
   
   A stub of the Pulumi plugin call (`compile exec:java`, port printed on 
stdout, one javac deprecation `[WARNING]`): first stdout line is `[WARNING] 
...` on 3.10.0 and `12345` on 3.9.16 and with each workaround above. Real 
Pulumi was not run.
   
   Not tested: macOS, Windows, a TTY stdout, Maven 4.x, the GitHub runner image.
   
   AI-assisted check by CyberNative AI LLC; this comment is AI-generated.
   


-- 
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]

Reply via email to