Enable console output target on Windows by default#88
Open
Joannis wants to merge 2 commits intoonevcat:masterfrom
Open
Enable console output target on Windows by default#88Joannis wants to merge 2 commits intoonevcat:masterfrom
Joannis wants to merge 2 commits intoonevcat:masterfrom
Conversation
Owner
|
Hi @Joannis, thanks for the PR! I don’t have any Windows experience, so I’d love your advice here. Would it make sense to add a TTY check on Windows to avoid emitting ANSI escape codes when output is redirected to a file/pipe? I’m thinking something like: #if os(Windows)
return isatty(fileno(stdout)) != 0 ? .console : .unknown
#else
// existing TERM + isatty logic
#endifIf that’s reasonable, I’d prefer to keep the default behavior consistent across platforms for TTY vs file output. Let me know what you think. |
Author
|
I can try that, IIRC Windows' terminals don't have all of the APIs you'd expect so I'm not certain |
Author
|
Hey @onevcat , sorry about the delay. Was not paying attention too much - but I've updated it |
Author
|
I forgot Windows likes to underscore symbols |
Author
|
Ping @onevcat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #87
Modern Windows terminals (Windows 10+, Windows Terminal, PowerShell) support ANSI escape codes. This change enables colored output by default on Windows by returning
.consoleas the detected output target.Changes
#if os(Windows)conditional compilation to return.consoledirectly on Windows