(command: str, timeout: int = 12)
| 302 | |
| 303 | |
| 304 | def run_powershell_json(command: str, timeout: int = 12) -> Any | None: |
| 305 | result = run_command( |
| 306 | [ |
| 307 | "powershell", |
| 308 | "-NoProfile", |
| 309 | "-ExecutionPolicy", |
| 310 | "Bypass", |
| 311 | "-Command", |
| 312 | command, |
| 313 | ], |
| 314 | timeout=timeout, |
| 315 | ) |
| 316 | if result.returncode != 0: |
| 317 | return None |
| 318 | text = result.stdout.strip() |
| 319 | if not text: |
| 320 | return None |
| 321 | try: |
| 322 | return json.loads(text) |
| 323 | except json.JSONDecodeError: |
| 324 | return None |
| 325 | |
| 326 | |
| 327 | def http_health(url: str, timeout: float = 2.5) -> tuple[bool, str]: |
no test coverage detected