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

Function getStdout

lib/internal/bootstrap/switches/is_main_thread.js:151–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149}
150
151function getStdout() {
152 if (stdout) return stdout;
153 stdout = createWritableStdioStream(1);
154 stdout.destroySoon = stdout.destroy;
155 // Override _destroy so that the fd is never actually closed.
156 stdoutDestroy = stdout._destroy;
157 stdout._destroy = dummyDestroy;
158 if (stdout.isTTY) {
159 process.on('SIGWINCH', refreshStdoutOnSigWinch);
160 }
161
162 addCleanup(function cleanupStdout() {
163 stdout._destroy = stdoutDestroy;
164 stdout.destroy();
165 process.removeListener('SIGWINCH', refreshStdoutOnSigWinch);
166 stdout = undefined;
167 });
168 // No need to add deserialize callback because stdout = undefined above
169 // causes the stream to be lazily initialized again later.
170 return stdout;
171}
172
173function getStderr() {
174 if (stderr) return stderr;

Callers

nothing calls this directly

Calls 5

addCleanupFunction · 0.85
onMethod · 0.45
destroyMethod · 0.45
removeListenerMethod · 0.45

Tested by

no test coverage detected