Serve requests in the foreground.
(args: argparse.Namespace)
| 608 | |
| 609 | @action(daemon_parser) |
| 610 | def do_daemon(args: argparse.Namespace) -> None: |
| 611 | """Serve requests in the foreground.""" |
| 612 | # Lazy import so this import doesn't slow down other commands. |
| 613 | from mypy.dmypy_server import Server, process_start_options |
| 614 | |
| 615 | if args.log_file: |
| 616 | sys.stdout = sys.stderr = open(args.log_file, "a", buffering=1) |
| 617 | fd = sys.stdout.fileno() |
| 618 | os.dup2(fd, 2) |
| 619 | os.dup2(fd, 1) |
| 620 | |
| 621 | if args.options_data: |
| 622 | from mypy.options import Options |
| 623 | |
| 624 | options_dict = pickle.loads(b64decode(args.options_data)) |
| 625 | options_obj = Options() |
| 626 | options = options_obj.apply_changes(options_dict) |
| 627 | else: |
| 628 | options = process_start_options(args.flags, allow_sources=False) |
| 629 | |
| 630 | Server(options, args.status_file, timeout=args.timeout).serve() |
| 631 | |
| 632 | |
| 633 | @action(help_parser) |
nothing calls this directly
no test coverage detected
searching dependent graphs…