##// END OF EJS Templates
py3: work around unicode stdio streams in contrib/hgclient.py
Yuya Nishihara -
r40351:431a8313 default
parent child Browse files
Show More
@@ -16,6 +16,13 b' except ImportError:'
16 16 import io
17 17 stringio = io.StringIO
18 18
19 if sys.version_info[0] >= 3:
20 stdout = sys.stdout.buffer
21 stderr = sys.stderr.buffer
22 else:
23 stdout = sys.stdout
24 stderr = sys.stderr
25
19 26 def connectpipe(path=None):
20 27 cmdline = [b'hg', b'serve', b'--cmdserver', b'pipe']
21 28 if path:
@@ -81,10 +88,10 b' def readchannel(server):'
81 88 def sep(text):
82 89 return text.replace(b'\\', b'/')
83 90
84 def runcommand(server, args, output=sys.stdout, error=sys.stderr, input=None,
91 def runcommand(server, args, output=stdout, error=stderr, input=None,
85 92 outfilter=lambda x: x):
86 93 print(b'*** runcommand', b' '.join(args))
87 sys.stdout.flush()
94 stdout.flush()
88 95 server.stdin.write(b'runcommand\n')
89 96 writeblock(server, b'\0'.join(args))
90 97
@@ -114,7 +121,7 b' def runcommand(server, args, output=sys.'
114 121 return
115 122
116 123 def check(func, connect=connectpipe):
117 sys.stdout.flush()
124 stdout.flush()
118 125 server = connect()
119 126 try:
120 127 return func(server)
General Comments 0
You need to be logged in to leave comments. Login now