Run a shell command and return the result.
(cmd: List[str], cwd: Path = None, capture_output: bool = True)
| 15 | |
| 16 | |
| 17 | def run_command(cmd: List[str], cwd: Path = None, capture_output: bool = True) -> subprocess.CompletedProcess: |
| 18 | """Run a shell command and return the result.""" |
| 19 | try: |
| 20 | result = subprocess.run(cmd, cwd=cwd, capture_output=capture_output, text=True, check=True) |
| 21 | return result |
| 22 | except subprocess.CalledProcessError as e: |
| 23 | print(f"Command failed: {' '.join(cmd)}") |
| 24 | print(f"Exit code: {e.returncode}") |
| 25 | print(f"Error output: {e.stderr}") |
| 26 | raise |
| 27 | |
| 28 | |
| 29 | def get_current_branch() -> str: |
no test coverage detected
searching dependent graphs…