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.
This commit is contained in:
parent
4597fba6ba
commit
a21e6f21fb
@ -105,7 +105,7 @@ def system(cmd: List[str], _stdin: Optional[IO[AnyStr]] = None, exit_on_error: b
|
|||||||
try:
|
try:
|
||||||
return check_output(cmd, stderr=STDOUT, stdin=_stdin).decode()
|
return check_output(cmd, stderr=STDOUT, stdin=_stdin).decode()
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
stderr.buffer.write(e.stdout)
|
stderr.buffer.write(bytes(e.stdout, encoding="utf8"))
|
||||||
print_stack()
|
print_stack()
|
||||||
if exit_on_error:
|
if exit_on_error:
|
||||||
exit(e.returncode)
|
exit(e.returncode)
|
||||||
|
Loading…
Reference in New Issue
Block a user