##// END OF EJS Templates
serve: accept multiple values for --daemon-postexec...
Jun Wu -
r28451:c90cfe76 default
parent child Browse files
Show More
@@ -827,16 +827,17 def service(opts, parentfn=None, initfn=
827 writepid(util.getpid())
827 writepid(util.getpid())
828
828
829 if opts['daemon_postexec']:
829 if opts['daemon_postexec']:
830 inst = opts['daemon_postexec']
831 try:
830 try:
832 os.setsid()
831 os.setsid()
833 except AttributeError:
832 except AttributeError:
834 pass
833 pass
834 for inst in opts['daemon_postexec']:
835 if inst.startswith('unlink:'):
835 if inst.startswith('unlink:'):
836 lockpath = inst[7:]
836 lockpath = inst[7:]
837 os.unlink(lockpath)
837 os.unlink(lockpath)
838 elif inst != 'none':
838 elif inst != 'none':
839 raise error.Abort(_('invalid value for --daemon-postexec'))
839 raise error.Abort(_('invalid value for --daemon-postexec: %s')
840 % inst)
840 util.hidewindow()
841 util.hidewindow()
841 sys.stdout.flush()
842 sys.stdout.flush()
842 sys.stderr.flush()
843 sys.stderr.flush()
@@ -6320,7 +6320,7 def root(ui, repo):
6320 [('A', 'accesslog', '', _('name of access log file to write to'),
6320 [('A', 'accesslog', '', _('name of access log file to write to'),
6321 _('FILE')),
6321 _('FILE')),
6322 ('d', 'daemon', None, _('run server in background')),
6322 ('d', 'daemon', None, _('run server in background')),
6323 ('', 'daemon-postexec', '', _('used internally by daemon mode')),
6323 ('', 'daemon-postexec', [], _('used internally by daemon mode')),
6324 ('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')),
6324 ('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')),
6325 # use string type, then we can check if something was passed
6325 # use string type, then we can check if something was passed
6326 ('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')),
6326 ('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')),
@@ -38,7 +38,7 if __name__ == '__main__':
38 parser.add_option('-f', '--foreground', dest='foreground',
38 parser.add_option('-f', '--foreground', dest='foreground',
39 action='store_true',
39 action='store_true',
40 help='do not start the HTTP server in the background')
40 help='do not start the HTTP server in the background')
41 parser.add_option('--daemon-postexec')
41 parser.add_option('--daemon-postexec', action='append')
42
42
43 (options, args) = parser.parse_args()
43 (options, args) = parser.parse_args()
44
44
General Comments 0
You need to be logged in to leave comments. Login now