Skip to content

Commit 2495855

Browse files
authored
Merge pull request #5 from vBLFTePebWNi6c/patch-1
Decode process output to "utf-8" instead of "ascii"
2 parents 369cb6a + e0df3b1 commit 2495855

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

flask_shell2http/classes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ def run_command(cmd: List[str], timeout: int, key: str) -> Dict:
3838
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,)
3939
try:
4040
outs, errs = proc.communicate(timeout=int(timeout))
41-
stdout = outs.decode("ascii")
42-
stderr = errs.decode("ascii")
41+
stdout = outs.decode("utf-8")
42+
stderr = errs.decode("utf-8")
4343
returncode = proc.returncode
4444
logger.info(f"Job: '{key}' --> finished with returncode: '{returncode}'.")
4545

4646
except subprocess.TimeoutExpired:
4747
proc.kill()
48-
stdout, _ = [s.decode("ascii") for s in proc.communicate()]
48+
stdout, _ = [s.decode("utf-8") for s in proc.communicate()]
4949
stderr = f"command timedout after {timeout} seconds."
5050
returncode = proc.returncode
5151
logger.error(f"Job: '{key}' --> failed. Reason: \"{stderr}\".")

0 commit comments

Comments
 (0)