Run HDC command with optional verbose output. Args: cmd: Command list to execute. **kwargs: Additional arguments for subprocess.run. Returns: CompletedProcess result.
(cmd: list, **kwargs)
| 15 | |
| 16 | |
| 17 | def _run_hdc_command(cmd: list, **kwargs) -> subprocess.CompletedProcess: |
| 18 | """ |
| 19 | Run HDC command with optional verbose output. |
| 20 | |
| 21 | Args: |
| 22 | cmd: Command list to execute. |
| 23 | **kwargs: Additional arguments for subprocess.run. |
| 24 | |
| 25 | Returns: |
| 26 | CompletedProcess result. |
| 27 | """ |
| 28 | if _HDC_VERBOSE: |
| 29 | print(f"[HDC] Running command: {' '.join(cmd)}") |
| 30 | |
| 31 | result = subprocess.run(cmd, **kwargs) |
| 32 | |
| 33 | if _HDC_VERBOSE and result.returncode != 0: |
| 34 | print(f"[HDC] Command failed with return code {result.returncode}") |
| 35 | if hasattr(result, 'stderr') and result.stderr: |
| 36 | print(f"[HDC] Error: {result.stderr}") |
| 37 | |
| 38 | return result |
| 39 | |
| 40 | |
| 41 | def set_hdc_verbose(verbose: bool): |
no test coverage detected