-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
fix: stop color mode on windows cmd/powershell #4076
Conversation
Work in progress - just opened PR to get feedback on general idea. My windows virtual machine box been building quarkus master (without tests) for the last 30 minutes and its over midnight so i'm going to sleep while my laptop spends some cpu cycles. Tomorrow i'll test and verify it works as expected. |
You can create a pull request as a "draft" PR. It's a relatively recent feature. When you go to open the pull request, the "create pull request" button has a dropdown menu on it; choose "open as draft" from there. |
core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
Show resolved
Hide resolved
core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
Outdated
Show resolved
Hide resolved
Why: * by default ANSI colors are not enabled for cmd/powershell on Windows 10 machines so users will by default get garbled output. This change addreses the need by: * Detect when running on Windows and NOT in known working windows emulators and there not enable colors. Solves quarkusio#1029
d937a73
to
e71e652
Compare
Okey, removing the WIP moniker as i finally got this tested. Had to remove System.console() test under windows as when running on cygwin console is null. screenshot above shows same app running in cygwin (left) and plain cmd.exe (right). Optimally I would like to have a way for users to force color on in case they have set the registry flag. Suggestions welcome :) |
@@ -35,6 +36,29 @@ | |||
*/ | |||
@Recorder | |||
public class LoggingSetupRecorder { | |||
|
|||
static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for the sake of avoiding possible NPE, it would be nice to use getProperty("os.name", "Linux")
, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if that happens you are on a non-java vm :)
core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
Outdated
Show resolved
Hide resolved
core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
Show resolved
Hide resolved
Why: * Windows cygwin has no console thus colors are disabled without reason. This change addreses the need by: * ignore System.console() test on Windows, keep it everywhere else.
e71e652
to
0b08468
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close enough, we can improve in a subsequent PR!
Why: * Windows is a pain when it comes to guessing color capabilities. Its many terminals has too many variances for our guesses to be always right. This change addreses the need by: * Make quarkus.log.console.color optional allowing users to force on/off and when left unset quarkus will take a best guess.
77289b7
to
513c6f2
Compare
Why:
on Windows 10 machines so users will by default get garbled output.
This change addreses the need by:
emulators and there not enable colors.
Solves #1029