Run a git command and return stdout, or None on failure.
(cmd: list[str], cwd: Path | None)
| 305 | # Run Metadata (Command/Git/Requirements) |
| 306 | # ============================================================================= |
| 307 | def _run_git_command(cmd: list[str], cwd: Path | None) -> str | None: |
| 308 | """Run a git command and return stdout, or None on failure.""" |
| 309 | try: |
| 310 | completed = subprocess.run( |
| 311 | cmd, |
| 312 | cwd=cwd, |
| 313 | check=True, |
| 314 | capture_output=True, |
| 315 | text=True, |
| 316 | ) |
| 317 | return completed.stdout.strip() |
| 318 | except Exception: |
| 319 | return None |
| 320 | |
| 321 | |
| 322 | def get_git_metadata(cwd: Path | None = None) -> dict[str, str]: |
no test coverage detected
searching dependent graphs…