##// END OF EJS Templates
procutil: always popen() in binary mode...
Yuya Nishihara -
r37476:00e4bd97 default
parent child Browse files
Show More
@@ -528,8 +528,8 b' class bzmysql(bzaccess):'
528 except TypeError:
528 except TypeError:
529 cmd = cmdfmt % {'bzdir': bzdir, 'id': id, 'user': user}
529 cmd = cmdfmt % {'bzdir': bzdir, 'id': id, 'user': user}
530 self.ui.note(_('running notify command %s\n') % cmd)
530 self.ui.note(_('running notify command %s\n') % cmd)
531 fp = procutil.popen('(%s) 2>&1' % cmd)
531 fp = procutil.popen('(%s) 2>&1' % cmd, 'rb')
532 out = fp.read()
532 out = util.fromnativeeol(fp.read())
533 ret = fp.close()
533 ret = fp.close()
534 if ret:
534 if ret:
535 self.ui.warn(out)
535 self.ui.warn(out)
@@ -228,13 +228,13 b' def createlog(ui, directory=None, root="'
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))
@@ -144,8 +144,8 b' def _sendmail(ui, sender, recipients, ms'
144 cmdline = '%s -f %s %s' % (program, stringutil.email(sender),
144 cmdline = '%s -f %s %s' % (program, stringutil.email(sender),
145 ' '.join(map(stringutil.email, recipients)))
145 ' '.join(map(stringutil.email, recipients)))
146 ui.note(_('sending mail: %s\n') % cmdline)
146 ui.note(_('sending mail: %s\n') % cmdline)
147 fp = procutil.popen(cmdline, 'w')
147 fp = procutil.popen(cmdline, 'wb')
148 fp.write(msg)
148 fp.write(util.tonativeeol(msg))
149 ret = fp.close()
149 ret = fp.close()
150 if ret:
150 if ret:
151 raise error.Abort('%s %s' % (
151 raise error.Abort('%s %s' % (
@@ -2103,8 +2103,9 b' def _externalpatch(ui, repo, patcher, pa'
2103 cwd = repo.root
2103 cwd = repo.root
2104 if cwd:
2104 if cwd:
2105 args.append('-d %s' % procutil.shellquote(cwd))
2105 args.append('-d %s' % procutil.shellquote(cwd))
2106 fp = procutil.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip,
2106 cmd = ('%s %s -p%d < %s'
2107 procutil.shellquote(patchname)))
2107 % (patcher, ' '.join(args), strip, procutil.shellquote(patchname)))
2108 fp = procutil.popen(cmd, 'rb')
2108 try:
2109 try:
2109 for line in util.iterfile(fp):
2110 for line in util.iterfile(fp):
2110 line = line.rstrip()
2111 line = line.rstrip()
General Comments 0
You need to be logged in to leave comments. Login now