server: write out pid using bytes IO instead of str IO
authorAugie Fackler <raf@durin42.com>
Sun, 28 May 2017 15:43:06 -0400
changeset 32581 d770a08ee9d9
parent 32580 0cec8ad579d4
child 32582 633c635a790a
server: write out pid using bytes IO instead of str IO
mercurial/server.py
--- 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']: