()
| 124 | |
| 125 | |
| 126 | def main() -> int: |
| 127 | args = parse_args() |
| 128 | scan_root = Path(args.root).resolve() |
| 129 | if not scan_root.exists(): |
| 130 | print(f"Scan root does not exist: {scan_root}", file=sys.stderr) |
| 131 | return 1 |
| 132 | if not DASHBOARD_DIR.exists(): |
| 133 | print(f"Dashboard assets are missing: {DASHBOARD_DIR}", file=sys.stderr) |
| 134 | return 1 |
| 135 | |
| 136 | server = ThreadingHTTPServer((args.host, args.port), build_handler(scan_root)) |
| 137 | url = f"http://{args.host}:{args.port}/dashboard/" |
| 138 | |
| 139 | if not args.no_open: |
| 140 | threading.Timer(0.2, lambda: webbrowser.open(url)).start() |
| 141 | |
| 142 | print(f"Benchmark dashboard serving {scan_root}") |
| 143 | print(f"Open {url}") |
| 144 | |
| 145 | try: |
| 146 | server.serve_forever() |
| 147 | except KeyboardInterrupt: |
| 148 | print("\nShutting down dashboard server.") |
| 149 | finally: |
| 150 | server.server_close() |
| 151 | return 0 |
| 152 | |
| 153 | |
| 154 | if __name__ == "__main__": |
no test coverage detected