def start_server(args: argparse.Namespace) -> None: """Start the server from command arguments and wait for it.""" # Lazy import so this import doesn't slow down other commands. from mypy.dmypy_server import daemonize, Server if daemonize(Server(args.flags).serve, args.log_file) != 0: sys.exit(1) wait_for_server()
def start_server(args: argparse.Namespace) -> None: """Start the server from command arguments and wait for it.""" # Lazy import so this import doesn't slow down other commands. from mypy.dmypy_server import daemonize, Server if daemonize(Server(args.flags).serve, args.log_file) != 0: sys.exit(1) wait_for_server()
def start_server(args: argparse.Namespace, allow_sources: bool = False) -> None: """Start the server from command arguments and wait for it.""" # Lazy import so this import doesn't slow down other commands. from mypy.dmypy_server import daemonize, process_start_options start_options = process_start_options(args.flags, allow_sources) if daemonize(start_options, args.status_file, timeout=args.timeout, log_file=args.log_file): sys.exit(2) wait_for_server(args.status_file)
def start_server(args: argparse.Namespace, allow_sources: bool = False) -> None: """Start the server from command arguments and wait for it.""" # Lazy import so this import doesn't slow down other commands. from mypy.dmypy_server import daemonize, process_start_options start_options = process_start_options(args.flags, allow_sources) if daemonize(start_options, args.status_file, timeout=args.timeout, log_file=args.log_file): sys.exit(2) wait_for_server(args.status_file)
def do_restart(args: argparse.Namespace) -> None: """Restart daemon. We first try to stop it politely if it's running. This also sets mypy flags (and has the same issues as start). """ try: response = request('stop') except SystemExit: pass else: if response: sys.exit("Status: %s" % str(response)) else: print("Daemon stopped") # Lazy import so this import doesn't slow down other commands. from mypy.dmypy_server import daemonize, Server if daemonize(Server(args.flags).serve, args.log_file): sys.exit(1) wait_for_server()
def do_start(args: argparse.Namespace) -> None: """Start daemon (it must not already be running). This is where mypy flags are set. Setting flags is a bit awkward; you have to use e.g.: dmypy start -- --strict since we don't want to duplicate mypy's huge list of flags. """ try: pid, sockname = get_status() except SystemExit as err: # Lazy import so this import doesn't slow down other commands. from mypy.dmypy_server import daemonize, Server if daemonize(Server(args.flags).serve, args.log_file): sys.exit(1) wait_for_server() else: sys.exit("Daemon is still alive")