Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.out.print isn't working after calling AnsiConsole.systemInstall(); #91

Closed
ghost opened this issue Jul 27, 2017 · 13 comments
Closed

Comments

@ghost
Copy link

ghost commented Jul 27, 2017

Title

@gnodet
Copy link
Member

gnodet commented Sep 20, 2017

What do you mean it does not work ? Please be more specific.

@ghost
Copy link
Author

ghost commented Nov 12, 2017

if you put
AnsiConsole.systemInstall(); System.out.print("Test");
nothing will print, however.
AnsiConsole.systemInstall(); System.out.println("Test");
works normally.

@sebialex
Copy link

sebialex commented Dec 1, 2017

@LavaGhost I'm also having this issue. So instead of System.out.print("Test"), try AnsiConsole.system_out.print("Test"). It worked for me.

@gnodet
Copy link
Member

gnodet commented Dec 1, 2017

Have you tried using System.out.print("Test"); System.out.flush(); ?
The reason is that the streams are not auto-flushing:
https://github.com/fusesource/jansi/blob/master/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java#L72

@sebialex
Copy link

sebialex commented Dec 1, 2017

Thanks, I'll try it out.

@JesseVelden
Copy link

JesseVelden commented Jan 27, 2018

I had the same issue. For me System.out.print does work on Windows but not on Bash-like terminals, there I had to add System.out.flush(); as @gnodet suggested.

@hboutemy
Copy link
Collaborator

it should be fixed by #95, which fixes encoding issues but also removes the flush requirement
if you can test latest SNAPSHOT, please do and confirm

@JesseVelden
Copy link

@hboutemy yes it works. I built the project with Maven and using the new jansi-1.17-SNAPSHOT.jar

@JesseVelden
Copy link

JesseVelden commented Jan 29, 2018

I noticed in the new snapshot, if the command line is forced to close (CTRL+C), there can be an issue that the custom color is displayed everywhere, even after closing the entire CMD prints colors in that color.
Re-running of the programming doesn't solve it. (Maybe I should make another issue)

@hboutemy
Copy link
Collaborator

yes, this is another issue
and on this one, I don't see how to detect and reset...

@slachiewicz
Copy link
Contributor

@MegaCookie please verify with latest SNAPSHOT, - from my tests problem with Ctrl-C should be fixed now

@936707967xxy
Copy link

你好,怎么添加logo?

@gnodet
Copy link
Member

gnodet commented Dec 2, 2020

The streams are in auto flush mode in 2.x, but a simple System.out.print("foo") does not ensure the string is written. the auto flush only kicks in when a newline is written, so an explicit call to flush() is required.

@gnodet gnodet closed this as completed Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants