comparison mercurial/server.py @ 38164:aac4be30e250

py3: wrap tempfile.mkstemp() to use bytes path This patch just flips the default to use a bytes path on Python 3. ca1cf9b3cce7 is backed out as the bundlepath should be bytes now.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 26 May 2018 12:14:04 +0900
parents d2bd29dffc6c
children e7aa113b14f7
comparison
equal deleted inserted replaced
38163:b39958d6b81b 38164:aac4be30e250
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 from __future__ import absolute_import 8 from __future__ import absolute_import
9 9
10 import os 10 import os
11 import tempfile
12 11
13 from .i18n import _ 12 from .i18n import _
14 13
15 from . import ( 14 from . import (
16 chgserver, 15 chgserver,
70 fp.write('%d\n' % pid) 69 fp.write('%d\n' % pid)
71 fp.close() 70 fp.close()
72 71
73 if opts['daemon'] and not opts['daemon_postexec']: 72 if opts['daemon'] and not opts['daemon_postexec']:
74 # Signal child process startup with file removal 73 # Signal child process startup with file removal
75 lockfd, lockpath = tempfile.mkstemp(prefix='hg-service-') 74 lockfd, lockpath = pycompat.mkstemp(prefix='hg-service-')
76 os.close(lockfd) 75 os.close(lockfd)
77 try: 76 try:
78 if not runargs: 77 if not runargs:
79 runargs = procutil.hgcmd() + pycompat.sysargv[1:] 78 runargs = procutil.hgcmd() + pycompat.sysargv[1:]
80 runargs.append('--daemon-postexec=unlink:%s' % lockpath) 79 runargs.append('--daemon-postexec=unlink:%s' % lockpath)