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
The walk stopped after 200 commits: lines older than 9f65b86 point at it.
100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 1–6why, one step back1import process from 'node:process';23export const isStandardStream = stream => STANDARD_STREAMS.includes(stream);4export const STANDARD_STREAMS = [process.stdin, process.stdout, process.stderr];5export const STANDARD_STREAMS_ALIASES = ['stdin', 'stdout', 'stderr'];6export const getStreamName = fdNumber => STANDARD_STREAMS_ALIASES[fdNumber] ?? `stdio[${fdNumber}]`;Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f
lines 7–12why, one step back78// `subprocess.all` is created by Execa itself, which then pipes `stdout`/`stderr` into it.9// `verbose` needs to tell that pipe apart from a user pipe, which it disables.10const allStreamSymbol = Symbol('execa.allStream');11export const setAllStream = stream => Object.assign(stream, {[allStreamSymbol]: true});12export const isAllStream = stream => stream?.[allStreamSymbol] === true;