Run a command and return output, raising error by default if command fails
(cmd)
| 19 | |
| 20 | |
| 21 | def run_cmd(cmd): |
| 22 | """Run a command and return output, raising error by default if command fails""" |
| 23 | |
| 24 | print(f"Running command: {cmd}") |
| 25 | result = sp.run(cmd, |
| 26 | shell=True, |
| 27 | stdout=sp.PIPE, |
| 28 | text=True, |
| 29 | stderr=sp.STDOUT) |
| 30 | if result.returncode != 0: |
| 31 | print(f"Failing command output:\n{result.stdout}") |
| 32 | sys.exit(1) |
| 33 | return result |
| 34 | |
| 35 | |
| 36 | def handle_check_failure(error_msg): |