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

Function check_output

Lib/test/test_venv.py:48–64  ·  view source on GitHub ↗
(cmd, encoding=None)

Source from the content-addressed store, hash-verified

46
47@requires_subprocess()
48def check_output(cmd, encoding=None):
49 p = subprocess.Popen(cmd,
50 stdout=subprocess.PIPE,
51 stderr=subprocess.PIPE,
52 env={**os.environ, "PYTHONHOME": ""})
53 out, err = p.communicate()
54 if p.returncode:
55 if verbose and err:
56 print(err.decode(encoding or 'utf-8', 'backslashreplace'))
57 raise subprocess.CalledProcessError(
58 p.returncode, cmd, out, err)
59 if encoding:
60 return (
61 out.decode(encoding, 'backslashreplace'),
62 err.decode(encoding, 'backslashreplace'),
63 )
64 return out, err
65
66class BaseTest(unittest.TestCase):
67 """Base class for venv tests."""

Callers 15

test_prefixesMethod · 0.70
test_sysconfigMethod · 0.70
test_executableMethod · 0.70
test_multiprocessingMethod · 0.70
test_macos_envMethod · 0.70

Calls 2

communicateMethod · 0.95
decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…