Mercurial > public > mercurial-scm > hg
comparison mercurial/server.py @ 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 | 3f0936b2cea9 |
children | e48cb1c7a902 |
comparison
equal
deleted
inserted
replaced
32547:0cec8ad579d4 | 32548:d770a08ee9d9 |
---|---|
27 '''Run a command as a service.''' | 27 '''Run a command as a service.''' |
28 | 28 |
29 def writepid(pid): | 29 def writepid(pid): |
30 if opts['pid_file']: | 30 if opts['pid_file']: |
31 if appendpid: | 31 if appendpid: |
32 mode = 'a' | 32 mode = 'ab' |
33 else: | 33 else: |
34 mode = 'w' | 34 mode = 'wb' |
35 fp = open(opts['pid_file'], mode) | 35 fp = open(opts['pid_file'], mode) |
36 fp.write(str(pid) + '\n') | 36 fp.write(str(pid).encode('latin1') + '\n') |
37 fp.close() | 37 fp.close() |
38 | 38 |
39 if opts['daemon'] and not opts['daemon_postexec']: | 39 if opts['daemon'] and not opts['daemon_postexec']: |
40 # Signal child process startup with file removal | 40 # Signal child process startup with file removal |
41 lockfd, lockpath = tempfile.mkstemp(prefix='hg-service-') | 41 lockfd, lockpath = tempfile.mkstemp(prefix='hg-service-') |