MCPcopy Index your code
hub / github.com/nodejs/node / capture

Function capture

deps/v8/tools/testrunner/utils/test_utils.py:63–75  ·  view source on GitHub ↗

Wrapper that replaces system stdout/stderr an provides the streams.

()

Source from the content-addressed store, hash-verified

61
62@contextlib.contextmanager
63def capture():
64 """Wrapper that replaces system stdout/stderr an provides the streams."""
65 oldout = sys.stdout
66 olderr = sys.stderr
67 try:
68 stdout=StringIO()
69 stderr=StringIO()
70 sys.stdout = stdout
71 sys.stderr = stderr
72 yield stdout, stderr
73 finally:
74 sys.stdout = oldout
75 sys.stderr = olderr
76
77
78def with_json_output(basedir):

Callers 1

run_testsMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected