diff mercurial/mail.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 bbd240f81ac5
line wrap: on
line diff
--- a/mercurial/mail.py	Sat Apr 07 13:46:32 2018 +0900
+++ b/mercurial/mail.py	Sat Apr 07 20:50:38 2018 +0900
@@ -144,8 +144,8 @@
     cmdline = '%s -f %s %s' % (program, stringutil.email(sender),
                                ' '.join(map(stringutil.email, recipients)))
     ui.note(_('sending mail: %s\n') % cmdline)
-    fp = procutil.popen(cmdline, 'w')
-    fp.write(msg)
+    fp = procutil.popen(cmdline, 'wb')
+    fp.write(util.tonativeeol(msg))
     ret = fp.close()
     if ret:
         raise error.Abort('%s %s' % (