|
|
@ -313,22 +313,21 @@ if __name__ == '__main__': |
|
|
|
sys.exit(0) |
|
|
|
|
|
|
|
if cmdname == 'gui': |
|
|
|
fd = daemon.get_fd_or_server(config) |
|
|
|
if isinstance(fd, int): |
|
|
|
fd, server = daemon.get_fd_or_server(config) |
|
|
|
if fd is not None: |
|
|
|
d = daemon.Daemon(config, fd) |
|
|
|
d.start() |
|
|
|
d.init_gui(config, plugins) |
|
|
|
sys.exit(0) |
|
|
|
else: |
|
|
|
server = fd |
|
|
|
result = server.gui(config_options) |
|
|
|
|
|
|
|
elif cmdname == 'daemon': |
|
|
|
subcommand = config.get('subcommand') |
|
|
|
assert subcommand in ['start', 'stop', 'status'] |
|
|
|
if subcommand == 'start': |
|
|
|
fd = daemon.get_fd_or_server(config) |
|
|
|
if isinstance(fd, int): |
|
|
|
fd, server = daemon.get_fd_or_server(config) |
|
|
|
if fd is not None: |
|
|
|
pid = os.fork() |
|
|
|
if pid: |
|
|
|
print_stderr("starting daemon (PID %d)" % pid) |
|
|
@ -343,7 +342,6 @@ if __name__ == '__main__': |
|
|
|
d.join() |
|
|
|
sys.exit(0) |
|
|
|
else: |
|
|
|
server = fd |
|
|
|
result = server.daemon(config_options) |
|
|
|
else: |
|
|
|
server = daemon.get_server(config) |
|
|
|