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
12345678910111213141516#!/usr/bin/env nodeimport process from 'node:process';import {execa} from '../../index.js';
const [options, file, commandArgument, unpipe] = process.argv.slice(2);const source = execa(file, [commandArgument], 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]);