| 84 | |
| 85 | |
| 86 | def run_cmd(cmd): |
| 87 | if isinstance(cmd, str): |
| 88 | cmd = cmd.split(' ') |
| 89 | |
| 90 | try: |
| 91 | output = subprocess.check_output(cmd) |
| 92 | except subprocess.CalledProcessError as e: |
| 93 | # this avoids hiding the stdout / stderr of failed processes |
| 94 | print('Command failed: %s' % cmd) |
| 95 | print('With output:') |
| 96 | print('--------------') |
| 97 | print(e.output) |
| 98 | print('--------------') |
| 99 | raise e |
| 100 | |
| 101 | if isinstance(output, bytes): |
| 102 | output = output.decode('utf-8') |
| 103 | return output |
| 104 | |
| 105 | |
| 106 | _REGEX_CI_DIRECTIVE = re.compile(r'\[[^\]]*\]') |