-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
Enable/Disable ANSI Sequences on Windows. #87
Conversation
Will port the changes from @zmwangx for |
Nit: It's a bit wierd when you check for isatty() in two places now (get_colorize) but looks good otherwise. Shouldn't we just use 'colorize' only, assuming it verifies isatty() if 'auto'? Other than that, it should work as expected. |
And what happens when user sets |
It's set to True, which is what the user wants, don't they? And if it's not a tty, then they probably are saving to a text file which is going to have colored text in it, when viewed with So, technically, the always option is sort of a way to shoot the user in the foot. This can also happen in non-Windows BTW, because this always option is not dependent on Windows. Anyway, I tried it, and the escape sequences to appear in the text file:
and I'm able to view the colored |
I know. But it doesn't look like a very regular use case. From my experience, users of Anyway, given the fact that there is an |
Wait, why do we need to call Does calling the API make any difference when you redirect output? |
It’s not only pointless to set console mode when stout is not a tty, it’s impossible to set it because guess what, it’s not a console. |
Right. The API |
Well.... what it means is that if But then |
I've decided to leave it in its current state and can't spend any more time on trivia. |
Once again, errors are not colored. Only the prompt is. Also, removing the condition doesn’t color stderr at all, since it will error out on stout. Coming up with weird fictional use cases doesn’t help with anything. googler is for humans, not fuzzers. I wrote every step of the logic and most loc in the current iteration of googler, so trust me, I have thought of everything. |
It's a simple usecase, |
$ https_proxy=255.255.255.255 googler 'not connected' > /tmp/blah
[ERROR] Failed to connect to proxy server 255.255.255.255: Remote end closed connection without response. No idea why that's in any way "unintelligle [sic]", and why color/ANSI escape sequence has anything to do with it. I'll say it one last time: ANSI escape sequences are not emitted in any error message. |
Looks like I was looking at an older version of code that fed sequences directly to Also, hold your horses: there still seems to be some of that code in |
Fixes #86