Closed benhoyt closed 11 years ago
Oddly, pss -C1 foo
colors correctly, but pss -C 1 foo
with the space doesn't color.
Hmm, that's indeed odd. It's non-trivial for me to come up with a Windows box for reproducing this, unfortunately.
Okay, I'll see if I can narrow this down.
Hmmm, this is actually a bug in colorama, which doesn't work properly in 64-bit Windows. The reason is that colorama's win32.py doesn't use ctypes correctly, specifically it doesn't specify the argtypes for Win32 functions. HANDLE on 64-bit Windows is a 64-bit value, so you need to specify these, otherwise ctypes assumes HANDLE is 32 bit. This is actually a fairly common (and easy-to-overlook) problem with ctypes on Windows. For example, here's another time I've run into this.
This is also why it works sometimes and not others -- it depends what's in memory on the stack. (I'm somewhat surprised I didn't see exceptions or core dumps, though.)
I've patched it locally by adding argtypes/restype for all the Win32 functions and the fix works.
I'll open a bug upstream on the colorama project site.
Great, thanks for researching. You can send a pull request for pss and we'll fix it locally for now.
Good idea. Pull request created: https://github.com/eliben/pss/pull/7
Merged, thanks.
For example, coloring works as expected with no command-line arguments:
But with certain command line arguments pss doesn't do any coloring:
However, some command line arguments do still color correctly, like
pss -a foo
.I'm using pss on Python 2.7.5, Windows 7 64-bit.