mercurial/server.py
changeset 32530 3f0936b2cea9
parent 32291 bd872f64a8ba
child 32548 d770a08ee9d9
equal deleted inserted replaced
32529:0ec17613582c 32530:3f0936b2cea9
     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 sys
       
    12 import tempfile
    11 import tempfile
    13 
    12 
    14 from .i18n import _
    13 from .i18n import _
    15 
    14 
    16 from . import (
    15 from . import (
    17     chgserver,
    16     chgserver,
    18     cmdutil,
    17     cmdutil,
    19     commandserver,
    18     commandserver,
    20     error,
    19     error,
    21     hgweb,
    20     hgweb,
       
    21     pycompat,
    22     util,
    22     util,
    23 )
    23 )
    24 
    24 
    25 def runservice(opts, parentfn=None, initfn=None, runfn=None, logfile=None,
    25 def runservice(opts, parentfn=None, initfn=None, runfn=None, logfile=None,
    26                runargs=None, appendpid=False):
    26                runargs=None, appendpid=False):
    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-')
    42         os.close(lockfd)
    42         os.close(lockfd)
    43         try:
    43         try:
    44             if not runargs:
    44             if not runargs:
    45                 runargs = util.hgcmd() + sys.argv[1:]
    45                 runargs = util.hgcmd() + pycompat.sysargv[1:]
    46             runargs.append('--daemon-postexec=unlink:%s' % lockpath)
    46             runargs.append('--daemon-postexec=unlink:%s' % lockpath)
    47             # Don't pass --cwd to the child process, because we've already
    47             # Don't pass --cwd to the child process, because we've already
    48             # changed directory.
    48             # changed directory.
    49             for i in xrange(1, len(runargs)):
    49             for i in xrange(1, len(runargs)):
    50                 if runargs[i].startswith('--cwd='):
    50                 if runargs[i].startswith('--cwd='):