检查命令行工具是否可用
(tool: str)
| 104 | |
| 105 | |
| 106 | def check_tool(tool: str) -> bool: |
| 107 | """检查命令行工具是否可用""" |
| 108 | try: |
| 109 | subprocess.run( |
| 110 | [tool, "--version"], |
| 111 | capture_output=True, |
| 112 | timeout=10, |
| 113 | ) |
| 114 | return True |
| 115 | except (FileNotFoundError, subprocess.TimeoutExpired): |
| 116 | return False |
| 117 | |
| 118 | |
| 119 | # ─── C++ 测试 ──────────────────────────────────────────────────────────────── |
no test coverage detected