##// END OF EJS Templates
serve: allow --daemon-postexec to be 'unlink:path' or 'none'...
Jun Wu -
r28195:213c8cf0 default
parent child Browse files
Show More
@@ -765,7 +765,7 b' def service(opts, parentfn=None, initfn='
765 try:
765 try:
766 if not runargs:
766 if not runargs:
767 runargs = util.hgcmd() + sys.argv[1:]
767 runargs = util.hgcmd() + sys.argv[1:]
768 runargs.append('--daemon-postexec=%s' % lockpath)
768 runargs.append('--daemon-postexec=unlink:%s' % lockpath)
769 # Don't pass --cwd to the child process, because we've already
769 # Don't pass --cwd to the child process, because we've already
770 # changed directory.
770 # changed directory.
771 for i in xrange(1, len(runargs)):
771 for i in xrange(1, len(runargs)):
@@ -799,12 +799,16 b' def service(opts, parentfn=None, initfn='
799 writepid(util.getpid())
799 writepid(util.getpid())
800
800
801 if opts['daemon_postexec']:
801 if opts['daemon_postexec']:
802 lockpath = opts['daemon_postexec']
802 inst = opts['daemon_postexec']
803 try:
803 try:
804 os.setsid()
804 os.setsid()
805 except AttributeError:
805 except AttributeError:
806 pass
806 pass
807 if inst.startswith('unlink:'):
808 lockpath = inst[7:]
807 os.unlink(lockpath)
809 os.unlink(lockpath)
810 elif inst != 'none':
811 raise error.Abort(_('invalid value for --daemon-postexec'))
808 util.hidewindow()
812 util.hidewindow()
809 sys.stdout.flush()
813 sys.stdout.flush()
810 sys.stderr.flush()
814 sys.stderr.flush()
General Comments 0
You need to be logged in to leave comments. Login now