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
12345678910111213141516#!/usr/bin/env nodeimport process from 'node:process';import {execa} from '../../index.js';
const [options, file, arg, unpipe] = process.argv.slice(2);const source = execa(file, [arg], JSON.parse(options));const destination = execa('stdin.js');const controller = new AbortController();const pipePromise = source.pipe(destination, {unpipeSignal: controller.signal});if (unpipe === 'true') { controller.abort(); destination.stdin.end();}
await Promise.allSettled([source, destination, pipePromise]);