(self, *args, **subprocess_args)
| 49 | return indent + f'{name}:\n' + prefixed_lines |
| 50 | |
| 51 | def run(self, *args, **subprocess_args): |
| 52 | if subprocess_args.get('shell'): |
| 53 | raise ValueError('Running the subprocess in shell mode is not supported.') |
| 54 | default_args = { |
| 55 | 'capture_output': True, |
| 56 | 'check': True, |
| 57 | } |
| 58 | try: |
| 59 | result = subprocess.run([self.interpreter, *args], **default_args | subprocess_args) |
| 60 | except subprocess.CalledProcessError as e: |
| 61 | if e.returncode != 0: |
| 62 | self._logger.error( |
| 63 | f'Interpreter returned non-zero exit status {e.returncode}.\n' |
| 64 | + self._format_output('COMMAND', shlex.join(e.cmd)) + '\n' |
| 65 | + self._format_output('STDOUT', e.stdout.decode()) + '\n' |
| 66 | + self._format_output('STDERR', e.stderr.decode()) + '\n' |
| 67 | ) |
| 68 | raise |
| 69 | else: |
| 70 | return result |
| 71 | |
| 72 | |
| 73 | class VirtualEnvironmentMixin: |
no test coverage detected