nested-stdio.js
This file
Path
test/fixtures/nested-stdio.js
28 lines · 993 bytes · JavaScript
Last changed by
Upgrade xo (#980)ehmickybefore adoptionccfa412
History of this fileTake it
The walk stopped after 200 commits: lines older than db95b51 point at it.
Fix calling `.kill()` many times (#768)ehmickybefore adoptiondb95b51
lines 1–2why, one step back1#!/usr/bin/env node2import process from 'node:process';Add support for `std*: ['pipe', 'inherit']` with `execaSync()` (#954)ehmickybefore adoptionc15edbc
lines 3–4why, one step back3import {execa, execaSync} from '../../index.js';4import {parseStdioOption} from '../helpers/stdio.js';Fix calling `.kill()` many times (#768)ehmickybefore adoptiondb95b51
line 5why, one step back5Upgrade xo (#980)ehmickybefore adoptionccfa412
line 6why, one step back6const [stdioOption, fdNumber, isSyncString, file, ...commandArguments] = process.argv.slice(2);Add support for `std*: ['pipe', 'inherit']` with `execaSync()` (#954)ehmickybefore adoptionc15edbc
lines 7–8why, one step back7const optionValue = parseStdioOption(stdioOption);8const isSync = isSyncString === 'true';Fix calling `.kill()` many times (#768)ehmickybefore adoptiondb95b51
line 9why, one step back9const stdio = ['ignore', 'inherit', 'inherit'];Rename `index` to `fdNumber` (#862)ehmickybefore adoption295ef40
line 10why, one step back10stdio[fdNumber] = optionValue;Add support for `std*: ['pipe', 'inherit']` with `execaSync()` (#954)ehmickybefore adoptionc15edbc
line 11why, one step back11const execaMethod = isSync ? execaSync : execa;Upgrade xo (#980)ehmickybefore adoptionccfa412
line 12why, one step back12const returnValue = execaMethod(file, [`${fdNumber}`, ...commandArguments], {stdio});Fix calling `.kill()` many times (#768)ehmickybefore adoptiondb95b51
lines 13–14why, one step back1314const shouldPipe = Array.isArray(optionValue) && optionValue.includes('pipe');Add support for `std*: ['pipe', 'inherit']` with `execaSync()` (#954)ehmickybefore adoptionc15edbc
lines 15–16why, one step back15const fdReturnValue = returnValue.stdio[fdNumber];16const hasPipe = fdReturnValue !== undefined && fdReturnValue !== null;Fix calling `.kill()` many times (#768)ehmickybefore adoptiondb95b51
lines 17–18why, one step back1718if (shouldPipe && !hasPipe) {Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
line 19why, one step back19 throw new Error(`subprocess.stdio[${fdNumber}] is null.`);Fix calling `.kill()` many times (#768)ehmickybefore adoptiondb95b51
lines 20–22why, one step back20}2122if (!shouldPipe && hasPipe) {Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
line 23why, one step back23 throw new Error(`subprocess.stdio[${fdNumber}] should be null.`);Fix calling `.kill()` many times (#768)ehmickybefore adoptiondb95b51
lines 24–25why, one step back24}25Add support for `std*: ['pipe', 'inherit']` with `execaSync()` (#954)ehmickybefore adoptionc15edbc
lines 26–28why, one step back26if (!isSync) {27 await returnValue;28}