forward.js
This file
Path
lib/stdio/forward.js
18 lines · 1.1 KiB · JavaScript
Last changed by
Print output with `verbose` option (#884)ehmickybefore adoption6fda30f
History of this fileTake it
Split files (#837)ehmickybefore adoption672c2d7
lines 1–8why, one step back1// When the `std*: Iterable | WebStream | URL | filePath`, `input` or `inputFile` option is used, we pipe to `childProcess.std*`.2// When the `std*: Array` option is used, we emulate some of the native values ('inherit', Node.js stream and file descriptor integer). To do so, we also need to pipe to `childProcess.std*`.3// Therefore the `std*` options must be either `pipe` or `overlapped`. Other values do not set `childProcess.std*`.4export const forwardStdio = stdioStreamsGroups => stdioStreamsGroups.map(stdioStreams => forwardStdioItem(stdioStreams));56// Whether `childProcess.std*` will be set7export const willPipeStreams = stdioStreams => PIPED_STDIO_VALUES.has(forwardStdioItem(stdioStreams));8Print output with `verbose` option (#884)ehmickybefore adoption6fda30f
line 9why, one step back9export const PIPED_STDIO_VALUES = new Set(['pipe', 'overlapped', undefined, null]);Split files (#837)ehmickybefore adoption672c2d7
lines 10–18why, one step back1011const forwardStdioItem = stdioStreams => {12 if (stdioStreams.length > 1) {13 return stdioStreams.some(({value}) => value === 'overlapped') ? 'overlapped' : 'pipe';14 }1516 const [stdioStream] = stdioStreams;17 return stdioStream.type !== 'native' && stdioStream.value !== 'overlapped' ? 'pipe' : stdioStream.value;18};