Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion invoke/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ def get():
yield data
for data in codecs.iterdecode(get(), encoding, errors='replace'):
if not hide:
dst.write(data)
# Make sure no UnicodeError happens, even if the data is
# garbled (e.g. due to encoding mismatch with the child).
encoded_data = data.encode(dst.encoding, errors='replace')
clean_data = encoded_data.decode(dst.encoding)
dst.write(clean_data)
dst.flush()
cap.append(data)

Expand Down