maven-mvnd
maven-mvnd copied to clipboard
Interactive progress should go to stderr, not stdout
I need to get a list of dependencies for my project:
mvnd dependency:tree > out
This ran super fast, because mvnd is awesome, but it didn't show me the progress while running, and worse, the progress with all of the terminal escape codes was included in the output file from stdout. Also, the log output in the file was colored.
The behavior I expect is for mvnd to use stderr for progress, but only if stderr is a TTY, and that the log output to stdout is only colored if stdout is a TTY. This would match the behavior of the normal mvn command, except it would be fast and show the nice interactive progress:
mvn dependency:tree > out
While I tend to agree, there is currently a limitation in JLine which does not support setting up a terminal with stdin/stderr instead of stdin/stdout, so this will require a new JLine feature / release.
For the ansi sequences, they could be stripped out. Note that the -l command line option should also be handled accordingly.
Standard Maven's -B could help to get rid of the ansi sequences.
As a workaround, the desired behavior (progress + file output) can be achieved using the standard maven option
mvnd dependency:tree -l out
though the output in the out file still contains ansi sequences, but I'll fix this issue.