-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
Raw color codes in console output (Windows 7) #352
Comments
Do you have a Gemfile? Are you using |
I do and I am |
Is win32console in the Gemfile (and Gemfile.lock)? |
It's not in the |
What is the value of |
|
Hmm, that is odd. If you want to do some debugging, check out the definition of the method It seems that even with |
I just tested compilation with an explicit I also tested color support in I'll do some debugging with the mentioned method, but I can't imagine what should possibly go wrong in there ^^ |
Ok, it keeps getting stranger. I just modified def self.enable_ansi_colors?(io)
return false if !io.tty?
begin
puts require 'Win32/Console/ANSI' if RUBY_PLATFORM =~ /mswin|mingw/
rescue LoadError
return false
end
return true
end A Some things I noticed:
|
As a side note, this seems to check for UTF-8 support on Windows correctly: def self.enable_utf8?(io)
return true if !io.tty?
if RUBY_PLATFORM =~ /mswin|mingw/
`chcp`.include? "65001"
else
%w( LC_ALL LC_CTYPE LANG ).any? { |e| ENV[e] =~ /UTF/ }
end
end Results:
|
Will take a closer look later this week (it’s getting late here). In the mean time, can you run the nanoc tests locally? (clone the repository and type |
These tests are related to UTF-8 being enabled or not. Oddly, I don’t have any tests that check for colors. |
Sure, will do |
No errors or failures that seem to be related to this problem. Here's the test output. Had some work to do to get everything up and running on Windows, but the specifics are OT. If you're interested in less stuff exploding when trying to run nanoc's test suite on Windows, I can wrap up a PR 😉 |
Fixes for Windows are certainly welcome! I think we’ve stumbled on two separate issues here: first, nanoc not detecting UTF-8 properly (the The color issue might be related to the fact that nanoc wraps and replaces |
@raphinesse I’m guessing the test fixes on Windows didn’t solve the original color problem yet. Am I right? |
Yep, still an issue. To summarize:
When working on the tests issue I noticed the same faulty behaviour with the messages from other tools.
So this might not be a |
This is very odd. Win32console replaces Can you try to print |
This makes it at least totally reasonable that it is not working as expected 😁 |
Hmm, very strange. It seems |
Well, after spending the better part of the evening with looking for a dependency that reset the value of
So to fix this we only need to |
Oh, yikes. That was totally non-obvious. Awesome work on the debugging 👍 I’ll whip up a PR and let you review it. I’ll add you to the release notes for 3.6.7. How would you like to be credited? I usually use the full name, but GitHub alias is fine too. |
@raphinesse See #356, a PR that hopefully fixes this problem. Let me know if this works for you. |
I'd prefer my full name. Should be in the commits as author. |
PR merged, so I’ll close this issue. It’ll be in the upcoming 3.6.7 release. |
👍 |
To clarify the issue, here's the start of the output of
nanoc help
on my machinenanoc --version
gem list
I suppose it's a nanoc bug since colors work fine when watching my site with
guard
.The text was updated successfully, but these errors were encountered: