##// END OF EJS Templates
py3: provide bytes stdin/out/err through util module...
Yuya Nishihara -
r30472:277f4fe6 default
parent child Browse files
Show More
@@ -44,6 +44,12 b' if ispy3:'
44 ospathsep = os.pathsep.encode('ascii')
44 ospathsep = os.pathsep.encode('ascii')
45 ossep = os.sep.encode('ascii')
45 ossep = os.sep.encode('ascii')
46
46
47 # TODO: .buffer might not exist if std streams were replaced; we'll need
48 # a silly wrapper to make a bytes stream backed by a unicode one.
49 stdin = sys.stdin.buffer
50 stdout = sys.stdout.buffer
51 stderr = sys.stderr.buffer
52
47 # Since Python 3 converts argv to wchar_t type by Py_DecodeLocale() on Unix,
53 # Since Python 3 converts argv to wchar_t type by Py_DecodeLocale() on Unix,
48 # we can use os.fsencode() to get back bytes argv.
54 # we can use os.fsencode() to get back bytes argv.
49 #
55 #
@@ -100,6 +106,9 b' else:'
100 osname = os.name
106 osname = os.name
101 ospathsep = os.pathsep
107 ospathsep = os.pathsep
102 ossep = os.sep
108 ossep = os.sep
109 stdin = sys.stdin
110 stdout = sys.stdout
111 stderr = sys.stderr
103 sysargv = sys.argv
112 sysargv = sys.argv
104
113
105 stringio = io.StringIO
114 stringio = io.StringIO
@@ -54,6 +54,9 b' httpserver = pycompat.httpserver'
54 pickle = pycompat.pickle
54 pickle = pycompat.pickle
55 queue = pycompat.queue
55 queue = pycompat.queue
56 socketserver = pycompat.socketserver
56 socketserver = pycompat.socketserver
57 stderr = pycompat.stderr
58 stdin = pycompat.stdin
59 stdout = pycompat.stdout
57 stringio = pycompat.stringio
60 stringio = pycompat.stringio
58 urlerr = pycompat.urlerr
61 urlerr = pycompat.urlerr
59 urlparse = pycompat.urlparse
62 urlparse = pycompat.urlparse
@@ -62,6 +65,7 b' xmlrpclib = pycompat.xmlrpclib'
62
65
63 if os.name == 'nt':
66 if os.name == 'nt':
64 from . import windows as platform
67 from . import windows as platform
68 stdout = platform.winstdout(pycompat.stdout)
65 else:
69 else:
66 from . import posix as platform
70 from . import posix as platform
67
71
General Comments 0
You need to be logged in to leave comments. Login now