forward.js
This file
Path
lib/stdio/forward.js
16 lines · 909 bytes · JavaScript
Last changed by
Refactor `stdio` option (#927)ehmickybefore adoptionc9cdd2d
History of this fileTake it
Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
line 1why, one step back1// Whether `subprocess.std*` will be setRefactor `stdio` option (#927)ehmickybefore adoptionc9cdd2d
line 2why, one step back2export const willPipeFileDescriptor = stdioItems => PIPED_STDIO_VALUES.has(forwardStdio(stdioItems));Split files (#837)ehmickybefore adoption672c2d7
line 3why, one step back3Print output with `verbose` option (#884)ehmickybefore adoption6fda30f
line 4why, one step back4export const PIPED_STDIO_VALUES = new Set(['pipe', 'overlapped', undefined, null]);Split files (#837)ehmickybefore adoption672c2d7
line 5why, one step back5Refactor `stdio` option (#927)ehmickybefore adoptionc9cdd2d
lines 6–11why, one step back6// When the `std*: Iterable | WebStream | URL | filePath`, `input` or `inputFile` option is used, we pipe to `subprocess.std*`.7// 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 `subprocess.std*`.8// Therefore the `std*` options must be either `pipe` or `overlapped`. Other values do not set `subprocess.std*`.9export const forwardStdio = stdioItems => {10 if (stdioItems.length > 1) {11 return stdioItems.some(({value}) => value === 'overlapped') ? 'overlapped' : 'pipe';Split files (#837)ehmickybefore adoption672c2d7
lines 12–13why, one step back12 }13Refactor `stdio` option (#927)ehmickybefore adoptionc9cdd2d
lines 14–15why, one step back14 const [{type, value}] = stdioItems;15 return type === 'native' ? value : 'pipe';Split files (#837)ehmickybefore adoption672c2d7
line 16why, one step back16};