MCPcopy Index your code
hub / github.com/python/cpython / run

Method run

Lib/test/support/venv.py:51–70  ·  view source on GitHub ↗
(self, *args, **subprocess_args)

Source from the content-addressed store, hash-verified

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
73class VirtualEnvironmentMixin:

Callers 5

run_test_scriptFunction · 0.45
_is_gui_availableFunction · 0.45
run_commandFunction · 0.45
_get_sysctlFunction · 0.45
_generate_po_fileFunction · 0.45

Calls 5

_format_outputMethod · 0.95
getMethod · 0.45
errorMethod · 0.45
joinMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected