ti icon indicating copy to clipboard operation
ti copied to clipboard

ti log crashes with pipe

Open francoisbeaulieu opened this issue 9 years ago • 2 comments

Hi,

Any idea why 'ti log' would crash anytime you try to pipe the output to another command? I'm running Python2.7 on Mac OSX Yosemite.

Output:

% ti log | grep PCO Traceback (most recent call last): File "/usr/local/bin/ti", line 434, in main() File "/usr/local/bin/ti", line 426, in main fn(**args) File "/usr/local/bin/ti", line 235, in action_log end=' ← working\n' if current == name else '\n') UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-2: ordinal not in range(128)

francoisbeaulieu avatar Oct 02 '15 19:10 francoisbeaulieu

Submitted pull request #19. For some reason when the output is piped, the unicode character '←' isn't being encoded properly. You could just convert that character to ascii (<--) or add the explicit encode after the string: '← working\n'.encode('utf-8')

MattHulse avatar Oct 05 '15 04:10 MattHulse

The committed patch does appear to fix my issue. Thanks!

francoisbeaulieu avatar Oct 05 '15 14:10 francoisbeaulieu