changeset 32548:d770a08ee9d9

server: write out pid using bytes IO instead of str IO
author Augie Fackler <raf@durin42.com>
date Sun, 28 May 2017 15:43:06 -0400
parents 0cec8ad579d4
children 633c635a790a
files mercurial/server.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/server.py	Sun May 28 13:28:41 2017 -0400
+++ b/mercurial/server.py	Sun May 28 15:43:06 2017 -0400
@@ -29,11 +29,11 @@
     def writepid(pid):
         if opts['pid_file']:
             if appendpid:
-                mode = 'a'
+                mode = 'ab'
             else:
-                mode = 'w'
+                mode = 'wb'
             fp = open(opts['pid_file'], mode)
-            fp.write(str(pid) + '\n')
+            fp.write(str(pid).encode('latin1') + '\n')
             fp.close()
 
     if opts['daemon'] and not opts['daemon_postexec']: