Skip to content

Commit

Permalink
Made logger convert output to utf-8 including errors
Browse files Browse the repository at this point in the history
This prevents a regular error in the python2 build where the output is
in byte format but is not valid utf-8, so the logger crashes because
the format is wrong.
  • Loading branch information
inclement committed Aug 13, 2017
1 parent 96098ce commit cee7718
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pythonforandroid/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ def shprint(command, *args, **kwargs):
output = command(*args, **kwargs)
for line in output:
if logger.level > logging.DEBUG:
if isinstance(line, bytes):
line = line.decode('utf-8', errors='replace')
msg = line.replace(
'\n', ' ').replace(
'\t', ' ').replace(
Expand Down

0 comments on commit cee7718

Please sign in to comment.