utils.js
This file
Path
lib/utils.js
21 lines · 858 bytes · JavaScript
Last changed by
Add support for transforms with `execaSync()` (#945)ehmickybefore adoptionc5f9f09
History of this fileTake it
`.pipe()` shortcut for `$` (#840)ehmickybefore adoption316f562
line 1why, one step back1import {ChildProcess} from 'node:child_process';Split files (#837)ehmickybefore adoption672c2d7
lines 2–19why, one step back2import {addAbortListener} from 'node:events';3import process from 'node:process';45export const isStandardStream = stream => STANDARD_STREAMS.includes(stream);6export const STANDARD_STREAMS = [process.stdin, process.stdout, process.stderr];7export const STANDARD_STREAMS_ALIASES = ['stdin', 'stdout', 'stderr'];89export const incrementMaxListeners = (eventEmitter, maxListenersIncrement, signal) => {10 const maxListeners = eventEmitter.getMaxListeners();11 if (maxListeners === 0 || maxListeners === Number.POSITIVE_INFINITY) {12 return;13 }1415 eventEmitter.setMaxListeners(maxListeners + maxListenersIncrement);16 addAbortListener(signal, () => {17 eventEmitter.setMaxListeners(eventEmitter.getMaxListeners() - maxListenersIncrement);18 });19};`.pipe()` shortcut for `$` (#840)ehmickybefore adoption316f562
line 20why, one step back20Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
line 21why, one step back21export const isSubprocess = value => value instanceof ChildProcess;