comparison mercurial/server.py @ 37119:d4a2e0d5d042

procutil: bulk-replace util.std* to point to new module
author Yuya Nishihara <yuya@tcha.org>
date Sat, 24 Mar 2018 15:09:33 +0900
parents bfcd0d227972
children a8a902d7176e
comparison
equal deleted inserted replaced
37118:5be286db5fb5 37119:d4a2e0d5d042
18 commandserver, 18 commandserver,
19 error, 19 error,
20 hgweb, 20 hgweb,
21 pycompat, 21 pycompat,
22 util, 22 util,
23 )
24
25 from .utils import (
26 procutil,
23 ) 27 )
24 28
25 def runservice(opts, parentfn=None, initfn=None, runfn=None, logfile=None, 29 def runservice(opts, parentfn=None, initfn=None, runfn=None, logfile=None,
26 runargs=None, appendpid=False): 30 runargs=None, appendpid=False):
27 '''Run a command as a service.''' 31 '''Run a command as a service.'''
85 os.chdir(inst[6:]) 89 os.chdir(inst[6:])
86 elif inst != 'none': 90 elif inst != 'none':
87 raise error.Abort(_('invalid value for --daemon-postexec: %s') 91 raise error.Abort(_('invalid value for --daemon-postexec: %s')
88 % inst) 92 % inst)
89 util.hidewindow() 93 util.hidewindow()
90 util.stdout.flush() 94 procutil.stdout.flush()
91 util.stderr.flush() 95 procutil.stderr.flush()
92 96
93 nullfd = os.open(os.devnull, os.O_RDWR) 97 nullfd = os.open(os.devnull, os.O_RDWR)
94 logfilefd = nullfd 98 logfilefd = nullfd
95 if logfile: 99 if logfile:
96 logfilefd = os.open(logfile, os.O_RDWR | os.O_CREAT | os.O_APPEND, 100 logfilefd = os.open(logfile, os.O_RDWR | os.O_CREAT | os.O_APPEND,