2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-14 03:37:49 +00:00

Fix unicode error on stdout piping

When confetty runs in a UTF-8 terminal, things are fine.  However python
assumes ascii only when piped.  Catch the situation and force utf-8
encoding rather than erroring out in such a circumstance
This commit is contained in:
Jarrod Johnon 2015-01-20 16:11:16 -05:00
parent de383630cf
commit 14ce9970ad

View File

@ -258,7 +258,10 @@ def print_result(res):
output = '{0:<40} {1:>39}'.format(attrstr, notestr)
else:
output = attrstr
print(output)
try:
print(output)
except UnicodeDecodeError:
print(output.encode('utf-8'))
def do_command(command, server):