##// END OF EJS Templates
dispatch: remove Python 2 function variants...
Gregory Szorc -
r49746:4eae5333 default
parent child Browse files
Show More
@@ -149,8 +149,6 b' def run():'
149 sys.exit(status & 255)
149 sys.exit(status & 255)
150
150
151
151
152 if pycompat.ispy3:
153
154 def initstdio():
152 def initstdio():
155 # stdio streams on Python 3 are io.TextIOWrapper instances proxying another
153 # stdio streams on Python 3 are io.TextIOWrapper instances proxying another
156 # buffer. These streams will normalize \n to \r\n by default. Mercurial's
154 # buffer. These streams will normalize \n to \r\n by default. Mercurial's
@@ -177,10 +175,7 b' if pycompat.ispy3:'
177 kwargs["write_through"] = sys.stdout.write_through
175 kwargs["write_through"] = sys.stdout.write_through
178 # pytype: enable=attribute-error
176 # pytype: enable=attribute-error
179 sys.stdout = io.TextIOWrapper(
177 sys.stdout = io.TextIOWrapper(
180 sys.stdout.buffer,
178 sys.stdout.buffer, sys.stdout.encoding, sys.stdout.errors, **kwargs
181 sys.stdout.encoding,
182 sys.stdout.errors,
183 **kwargs
184 )
179 )
185
180
186 if sys.stderr is not None:
181 if sys.stderr is not None:
@@ -193,10 +188,7 b' if pycompat.ispy3:'
193 kwargs["write_through"] = sys.stderr.write_through
188 kwargs["write_through"] = sys.stderr.write_through
194 # pytype: enable=attribute-error
189 # pytype: enable=attribute-error
195 sys.stderr = io.TextIOWrapper(
190 sys.stderr = io.TextIOWrapper(
196 sys.stderr.buffer,
191 sys.stderr.buffer, sys.stderr.encoding, sys.stderr.errors, **kwargs
197 sys.stderr.encoding,
198 sys.stderr.errors,
199 **kwargs
200 )
192 )
201
193
202 if sys.stdin is not None:
194 if sys.stdin is not None:
@@ -210,6 +202,7 b' if pycompat.ispy3:'
210 line_buffering=sys.stdin.line_buffering,
202 line_buffering=sys.stdin.line_buffering,
211 )
203 )
212
204
205
213 def _silencestdio():
206 def _silencestdio():
214 for fp in (sys.stdout, sys.stderr):
207 for fp in (sys.stdout, sys.stderr):
215 if fp is None:
208 if fp is None:
@@ -228,16 +221,6 b' if pycompat.ispy3:'
228 pass
221 pass
229
222
230
223
231 else:
232
233 def initstdio():
234 for fp in (sys.stdin, sys.stdout, sys.stderr):
235 procutil.setbinary(fp)
236
237 def _silencestdio():
238 pass
239
240
241 def _formatargs(args):
224 def _formatargs(args):
242 return b' '.join(procutil.shellquote(a) for a in args)
225 return b' '.join(procutil.shellquote(a) for a in args)
243
226
General Comments 0
You need to be logged in to leave comments. Login now