Comments
Patch
@@ -827,16 +827,17 @@
writepid(util.getpid())
if opts['daemon_postexec']:
- inst = opts['daemon_postexec']
try:
os.setsid()
except AttributeError:
pass
- if inst.startswith('unlink:'):
- lockpath = inst[7:]
- os.unlink(lockpath)
- elif inst != 'none':
- raise error.Abort(_('invalid value for --daemon-postexec'))
+ for inst in opts['daemon_postexec']:
+ if inst.startswith('unlink:'):
+ lockpath = inst[7:]
+ os.unlink(lockpath)
+ elif inst != 'none':
+ raise error.Abort(_('invalid value for --daemon-postexec: %s')
+ % inst)
util.hidewindow()
sys.stdout.flush()
sys.stderr.flush()
@@ -6276,7 +6276,7 @@
[('A', 'accesslog', '', _('name of access log file to write to'),
_('FILE')),
('d', 'daemon', None, _('run server in background')),
- ('', 'daemon-postexec', '', _('used internally by daemon mode')),
+ ('', 'daemon-postexec', [], _('used internally by daemon mode')),
('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')),
# use string type, then we can check if something was passed
('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')),
@@ -38,7 +38,7 @@
parser.add_option('-f', '--foreground', dest='foreground',
action='store_true',
help='do not start the HTTP server in the background')
- parser.add_option('--daemon-postexec')
+ parser.add_option('--daemon-postexec', action='append')
(options, args) = parser.parse_args()