comparison hgext/convert/cvsps.py @ 37458:00e4bd97b095

procutil: always popen() in binary mode On Python 3, non-binary stream is useless. Let's convert line ending by ourselves. Note that we don't need fromnativeeol() in patch._externalpatch() since any whitespace characters are rstrip()-ed.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 07 Apr 2018 20:50:38 +0900
parents a8a902d7176e
children 34758397ad1b
comparison
equal deleted inserted replaced
37457:d83191e9749b 37458:00e4bd97b095
226 226
227 cmd = [procutil.shellquote(arg) for arg in cmd] 227 cmd = [procutil.shellquote(arg) for arg in cmd]
228 ui.note(_("running %s\n") % (' '.join(cmd))) 228 ui.note(_("running %s\n") % (' '.join(cmd)))
229 ui.debug("prefix=%r directory=%r root=%r\n" % (prefix, directory, root)) 229 ui.debug("prefix=%r directory=%r root=%r\n" % (prefix, directory, root))
230 230
231 pfp = procutil.popen(' '.join(cmd)) 231 pfp = procutil.popen(' '.join(cmd), 'rb')
232 peek = pfp.readline() 232 peek = util.fromnativeeol(pfp.readline())
233 while True: 233 while True:
234 line = peek 234 line = peek
235 if line == '': 235 if line == '':
236 break 236 break
237 peek = pfp.readline() 237 peek = util.fromnativeeol(pfp.readline())
238 if line.endswith('\n'): 238 if line.endswith('\n'):
239 line = line[:-1] 239 line = line[:-1]
240 #ui.debug('state=%d line=%r\n' % (state, line)) 240 #ui.debug('state=%d line=%r\n' % (state, line))
241 241
242 if state == 0: 242 if state == 0: