Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit ce4605a

Browse files
committed
Fix SSH not handling strings for IOBuffer
1 parent ca2058a commit ce4605a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ltp/ssh.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,11 @@ def _reset(self, timeout: float = 30, iobuffer: IOBuffer = None) -> None:
234234

235235
data = os.read(stdout, 1024)
236236
if iobuffer:
237-
iobuffer.write(data)
237+
rdata = data.decode(
238+
encoding="utf-8",
239+
errors="ignore")
240+
241+
iobuffer.write(rdata)
238242
iobuffer.flush()
239243

240244
if proc.poll() is not None:
@@ -341,8 +345,7 @@ def run_command(
341345

342346
stdout_str += line
343347
if iobuffer:
344-
data = line.encode(encoding='utf-8')
345-
iobuffer.write(data)
348+
iobuffer.write(line)
346349
iobuffer.flush()
347350

348351
t_end = time.time() - t_start

0 commit comments

Comments
 (0)