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

Doesn't work on command prompt #69

Closed
jredfox opened this issue May 25, 2022 · 3 comments
Closed

Doesn't work on command prompt #69

jredfox opened this issue May 25, 2022 · 3 comments

Comments

@jredfox
Copy link

jredfox commented May 25, 2022

Describe the bug
the printlines do not show color when running the program from a compiled jar via command prompt. java -jar jcolor.jar it printlines the escape characters but not the color

I noticed calling echo with an ansi escape sequence seems to fix this. If the terminal is command prompt you should apply a fix similar to this
new ProcessBuilder(new String[]{"cmd", "/c", "echo", "\u001B[42m A TEST�[0m"}).inheritIO().start().waitFor();

@dialex
Copy link
Owner

dialex commented May 29, 2022

Windows Command Prompt does not support ANSI escape codes by default. Check these workarounds.

@dialex dialex closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2022
@dialex dialex closed this as completed May 29, 2022
@jredfox
Copy link
Author

jredfox commented Oct 11, 2022 via email

@dialex
Copy link
Owner

dialex commented Oct 11, 2022

The link I shared has 4 workarounds, only one requires reg editing. I would like to avoid a 5th workaround.
Also, does your fix work for Windows, Linux and Mac? I don't want to go back to if (OS == WIN) then X else Y logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants