(command: str, version_args: Sequence[str] = ("-version",))
| 68 | |
| 69 | |
| 70 | def _command_version(command: str, version_args: Sequence[str] = ("-version",)) -> str: |
| 71 | try: |
| 72 | completed = subprocess.run( |
| 73 | [command, *version_args], |
| 74 | check=False, |
| 75 | capture_output=True, |
| 76 | text=True, |
| 77 | timeout=3, |
| 78 | ) |
| 79 | except Exception: |
| 80 | return "unavailable" |
| 81 | |
| 82 | text = (completed.stdout or completed.stderr or "").strip() |
| 83 | if not text: |
| 84 | return "unavailable" |
| 85 | |
| 86 | first_line = text.splitlines()[0].strip() |
| 87 | return first_line or "unavailable" |
no test coverage detected