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

Method run_command

Lib/test/test_regrtest.py:813–846  ·  view source on GitHub ↗
(self, args, input=None, exitcode=0, **kw)

Source from the content-addressed store, hash-verified

811 return match.group(1)
812
813 def run_command(self, args, input=None, exitcode=0, **kw):
814 if not input:
815 input = ''
816 if 'stderr' not in kw:
817 kw['stderr'] = subprocess.STDOUT
818
819 env = kw.pop('env', None)
820 if env is None:
821 env = dict(os.environ)
822 env.pop('SOURCE_DATE_EPOCH', None)
823
824 proc = subprocess.run(args,
825 text=True,
826 input=input,
827 stdout=subprocess.PIPE,
828 env=env,
829 **kw)
830 if proc.returncode != exitcode:
831 msg = ("Command %s failed with exit code %s, but exit code %s expected!\n"
832 "\n"
833 "stdout:\n"
834 "---\n"
835 "%s\n"
836 "---\n"
837 % (str(args), proc.returncode, exitcode, proc.stdout))
838 if proc.stderr:
839 msg += ("\n"
840 "stderr:\n"
841 "---\n"
842 "%s"
843 "---\n"
844 % proc.stderr)
845 self.fail(msg)
846 return proc
847
848 def run_python(self, args, isolated=True, **kw):
849 extraargs = []

Callers 2

run_pythonMethod · 0.95
run_batchMethod · 0.45

Calls 4

failMethod · 0.95
strFunction · 0.85
popMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected