stdio.js
This file
Path
lib/resolve/stdio.js
47 lines · 1.2 KiB · JavaScript
Last changed by
Add more code comments (#984)ehmickybefore adoptionfdd8a9f
History of this fileTake it
Rename files (#977)ehmickybefore adoption4b2e316
lines 1–17why, one step back1import {getStreamOutput} from '../io/contents.js';2import {waitForStream, isInputFileDescriptor} from './wait-stream.js';34// Read the contents of `subprocess.std*` and|or wait for its completion5export const waitForStdioStreams = ({subprocess, encoding, buffer, maxBuffer, lines, stripFinalNewline, verboseInfo, streamInfo}) => subprocess.stdio.map((stream, fdNumber) => waitForSubprocessStream({6 stream,7 fdNumber,8 encoding,9 buffer: buffer[fdNumber],10 maxBuffer: maxBuffer[fdNumber],11 lines: lines[fdNumber],12 allMixed: false,13 stripFinalNewline,14 verboseInfo,15 streamInfo,16}));17Add more code comments (#984)ehmickybefore adoptionfdd8a9f
line 18why, one step back18// Read the contents of `subprocess.std*` or `subprocess.all` and|or wait for its completionRename files (#977)ehmickybefore adoption4b2e316
lines 19–30why, one step back19export const waitForSubprocessStream = async ({stream, fdNumber, encoding, buffer, maxBuffer, lines, allMixed, stripFinalNewline, verboseInfo, streamInfo}) => {20 if (!stream) {21 return;22 }2324 const onStreamEnd = waitForStream(stream, fdNumber, streamInfo);25 if (isInputFileDescriptor(streamInfo, fdNumber)) {26 await onStreamEnd;27 return;28 }2930 const [output] = await Promise.all([Upgrade xo (#980)ehmickybefore adoptionccfa412
lines 31–43why, one step back31 getStreamOutput({32 stream,33 onStreamEnd,34 fdNumber,35 encoding,36 buffer,37 maxBuffer,38 lines,39 allMixed,40 stripFinalNewline,41 verboseInfo,42 streamInfo,43 }),Rename files (#977)ehmickybefore adoption4b2e316
lines 44–47why, one step back44 onStreamEnd,45 ]);46 return output;47};