You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Guillaume Boué (JIRA)" <ji...@apache.org> on 2017/06/18 19:46:01 UTC

[jira] [Commented] (MNG-6239) jansi messes up System.err and System.out

    [ https://issues.apache.org/jira/browse/MNG-6239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16053301#comment-16053301 ] 

Guillaume Boué commented on MNG-6239:
-------------------------------------

This can be reproduced outside of a Maven context, and is Jansi specific. It looks like the wrapped standard output stream [is not being auto-flushed|https://github.com/fusesource/jansi/blob/jansi-project-1.16/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java#L69-L70]. So you can have the previous behaviour by explicitly flushing:

{code:java}
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
System.err.printf("listen port: ");
System.err.flush();
String value = console.readLine().trim();
{code}

There is maybe a good reason for this, but I think you'll have better luck asking the Jansi folks about it.

> jansi messes up System.err and System.out
> -----------------------------------------
>
>                 Key: MNG-6239
>                 URL: https://issues.apache.org/jira/browse/MNG-6239
>             Project: Maven
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.0
>         Environment: Java 1.8.0_131, Ubuntu 17.04
>            Reporter: Simone Bordet
>            Priority: Blocker
>         Attachments: mvn-jansi.tgz
>
>
> I use the Maven Exec Plugin to run a class that asks for interactive input from the user. This was working in 3.3.9, but does not work in 3.5.0.
> Anything printed on {{System.err}} or {{System.out}} without a newline is not printed immediately on the terminal window.
> Example:
> {code:java}
> BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
> System.err.printf("listen port: ");
> String value = console.readLine().trim();
> {code}
> The example above would not print {{listen port:}} on the terminal.
> Attached you can find a project that reproduces this issue.
> Unpack the project and then run:
> {noformat}
> $ mvn install && mvn exec:exec
> {noformat}
> The expected output of the reproducer would be:
> {noformat}
> err.println
> out.println
> err.printerr.printfout.printout.printf
> {noformat}
> instead I get:
> {noformat}
> err.println
> out.println
> {noformat}
> Removing {{jansi-1.13.jar}} from {{$MAVEN/lib/}} fixes the issue.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)