nested-pipe-subprocess.js
This file
Path
test/fixtures/nested-pipe-subprocess.js
15 lines · 534 bytes · JavaScript
Last changed by
Upgrade xo (#980)ehmickybefore adoptionccfa412
History of this fileTake it
Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
lines 1–4why, one step back1#!/usr/bin/env node2import process from 'node:process';3import {execa} from '../../index.js';4Upgrade xo (#980)ehmickybefore adoptionccfa412
lines 5–6why, one step back5const [options, file, commandArgument, unpipe] = process.argv.slice(2);6const source = execa(file, [commandArgument], JSON.parse(options));Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
lines 7–15why, one step back7const destination = execa('stdin.js');8const controller = new AbortController();9const pipePromise = source.pipe(destination, {unpipeSignal: controller.signal});10if (unpipe === 'true') {11 controller.abort();12 destination.stdin.end();13}1415await Promise.allSettled([source, destination, pipePromise]);