mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-21 20:08:15 +00:00
decode instead of encoding in maybe_decode
legacy from when the bytes/unicode tower was upsidedown compared to how it is now
This commit is contained in:
parent
72a5b571ca
commit
56f141e170
@ -109,10 +109,10 @@ def run_cli_unicode(verb, argv, nodeargs=None, stdin=None, encoding=None):
|
||||
)
|
||||
def maybe_decode(result):
|
||||
code, stdout, stderr = result
|
||||
if isinstance(stdout, unicode):
|
||||
stdout = stdout.encode("utf-8")
|
||||
if isinstance(stderr, unicode):
|
||||
stderr = stderr.encode("utf-8")
|
||||
if isinstance(stdout, bytes):
|
||||
stdout = stdout.decode(encoding)
|
||||
if isinstance(stderr, bytes):
|
||||
stderr = stderr.decode(encoding)
|
||||
return code, stdout, stderr
|
||||
d.addCallback(maybe_decode)
|
||||
return d
|
||||
|
Loading…
Reference in New Issue
Block a user