standard-stream.js
This file
Path
lib/utils/standard-stream.js
12 lines · 752 bytes · JavaScript
Last changed by
Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f
History of this fileTake it
12345678910111213import process from 'node:process';
export const isStandardStream = stream => STANDARD_STREAMS.includes(stream);export const STANDARD_STREAMS = [process.stdin, process.stdout, process.stderr];export const STANDARD_STREAMS_ALIASES = ['stdin', 'stdout', 'stderr'];export const getStreamName = fdNumber => STANDARD_STREAMS_ALIASES[fdNumber] ?? `stdio[${fdNumber}]`;
// `subprocess.all` is created by Execa itself, which then pipes `stdout`/`stderr` into it.// `verbose` needs to tell that pipe apart from a user pipe, which it disables.const allStreamSymbol = Symbol('execa.allStream');export const setAllStream = stream => Object.assign(stream, {[allStreamSymbol]: true});export const isAllStream = stream => stream?.[allStreamSymbol] === true;