nested-pipe-subprocess.js
This file
Path
test/fixtures/nested-pipe-subprocess.js
15 lines · 510 bytes · JavaScript
Last changed by
Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
History of this fileTake it
Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
lines 1–15why, one step back1#!/usr/bin/env node2import process from 'node:process';3import {execa} from '../../index.js';45const [options, file, arg, unpipe] = process.argv.slice(2);6const source = execa(file, [arg], JSON.parse(options));7const 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]);