Skip to content

Commit

Permalink
Ensure SSH command output is output in correct encoding
Browse files Browse the repository at this point in the history
- Fixes #72
  • Loading branch information
virtuald committed Nov 10, 2023
1 parent 8f3909a commit 55dc796
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion robotpy_installer/sshcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from os.path import exists, join, expanduser, split as splitpath
from pathlib import PurePath, PurePosixPath
import socket
import sys
import typing


Expand Down Expand Up @@ -91,7 +92,11 @@ def exec_cmd(
if get_output:
buffer.write(line)
if print_output:
print(line, end="")
try:
print(line, end="")
except UnicodeEncodeError:
eline = line.encode(sys.stdout.encoding, "backslashreplace").decode(sys.stdout.encoding)
print(eline, end="")

retval = channel.recv_exit_status()

Expand Down

0 comments on commit 55dc796

Please sign in to comment.