From a21e6f21fb342af736ae36cb17ab854c56be88ba Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 31 Oct 2021 21:20:28 +0100 Subject: [PATCH] Write bytes to stderr when raising during system call libkeyringctl/util.py: Change `system()` to write bytes to stderr.buffer, as before CalledProcessError.stdout had been used, which returns a string. --- libkeyringctl/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libkeyringctl/util.py b/libkeyringctl/util.py index de6f7af..beaff6a 100644 --- a/libkeyringctl/util.py +++ b/libkeyringctl/util.py @@ -105,7 +105,7 @@ def system(cmd: List[str], _stdin: Optional[IO[AnyStr]] = None, exit_on_error: b try: return check_output(cmd, stderr=STDOUT, stdin=_stdin).decode() except CalledProcessError as e: - stderr.buffer.write(e.stdout) + stderr.buffer.write(bytes(e.stdout, encoding="utf8")) print_stack() if exit_on_error: exit(e.returncode)