mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 13:33:09 +00:00
Make stdio emulation more realistic, to trigger problem that was previously
missed by tests.
This commit is contained in:
parent
aa22c6e59b
commit
905ea9cafd
@ -11,6 +11,7 @@ from future.builtins import str as future_str
|
||||
if PY2:
|
||||
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, dict, list, object, range, str, max, min # noqa: F401
|
||||
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
import signal
|
||||
@ -105,9 +106,15 @@ def run_cli_native(verb, *args, **kwargs):
|
||||
# necessary. This works okay for ASCII and if LANG is set
|
||||
# appropriately. These aren't great constraints so we should move
|
||||
# away from this behavior.
|
||||
#
|
||||
# The encoding attribute doesn't change StringIO behavior on Python 2,
|
||||
# but it's there for realism of the emulation.
|
||||
stdin = StringIO(stdin)
|
||||
stdin.encoding = sys.stdin.encoding
|
||||
stdout = StringIO()
|
||||
stdout.encoding = sys.stdout.encoding
|
||||
stderr = StringIO()
|
||||
stderr.encoding = sys.stderr.encoding
|
||||
else:
|
||||
# The new behavior, the Python 3 behavior, is to accept unicode and
|
||||
# encode it using a specific encoding. For older versions of Python 3,
|
||||
|
Loading…
Reference in New Issue
Block a user