-
Notifications
You must be signed in to change notification settings - Fork 128
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
Terminal colors of executable programs on Windows. #64
Comments
Hi there - I'm glad to hear you're fining modd useful. This really should be in the README, since it's such a common issue. The short summary is as follows: The app that produces the console output detects whether it's connected to a TTY or not. If it is not, colour codes are not emitted. The only way for modd to "trick" client apps into thinking they are connected to a TTY would be to include full pseudo-TTY emulation, which is complex and hard to do cross-platform. I've decided that we can't go down that route. This leaves us with two remaining options:
So there you have it - this is the complete rundown on colour output. I think your best option is to figure out how to force colour output in your app, and then to add a flag to control this to your daemon. |
I've just added an explanatory note to the README. Let me know if you feel that this needs any expansion or clarification. |
@cortesi sorry for the (very) late reply. I'm using modd a lot and is amazing. Thank you very much. Today the problem with TTY and colours in my terminal has showed up again. I read the README but I'm too stupid to fix it alone. If in a project I'm using func init() {
// This is sort of cheating: if stdout is a character device, we assume
// that means it's a TTY. Unfortunately, there are many non-TTY
// character devices, but fortunately stdout is rarely set to any of
// them.
//
// We could solve this properly by pulling in a dependency on
// code.google.com/p/go.crypto/ssh/terminal, for instance, but as a
// heuristic for whether to print in color or in black-and-white, I'd
// really rather not.
fi, err := os.Stdout.Stat()
if err == nil {
m := os.ModeDevice | os.ModeCharDevice
isTTY = fi.Mode()&m == m
}
} I can fix it by forcing the After that I have a problem with another package which has a new logger middleware with new packages and so on. I need a way to handle this for all packages and so I need to force TTY!
I think a tool like modd really need this internally. Or at least we can find a way to force Windows somehow and we can update README. I hope in your abilities and in your altruism. |
Dear people, modd is amazing!
I'm using:
Windows 10
andpowershell
withdaemon: go run .
inmood.conf
,chi
router.Any hint for show colors in terminal?
I can see all lines of the same color (white).
I already read:
but for Windows nothing.
How to do? Any hope?
The text was updated successfully, but these errors were encountered: