Run a shell command and stream output to console.
(cmd, cwd=None, check=True)
| 155 | |
| 156 | |
| 157 | def run_command(cmd, cwd=None, check=True): |
| 158 | """Run a shell command and stream output to console.""" |
| 159 | if isinstance(cmd, str): |
| 160 | cmd = cmd.split() |
| 161 | print(f"$ {' '.join(cmd)}") |
| 162 | |
| 163 | result = subprocess.run(cmd, cwd=cwd, check=False) |
| 164 | |
| 165 | if check and result.returncode != 0: |
| 166 | sys.exit(result.returncode) |
| 167 | |
| 168 | return result |
| 169 | |
| 170 | |
| 171 | def jcache(args, check=True): |
no test coverage detected
searching dependent graphs…