Skip to content
Myr

Support file path and URL types in the `stdout` and `stderr` options (#621)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent 4110dfc · Browse files · 7 files+225 added−93 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+225 added−93 removed

  • tests:+119 added−22 removed
  • other:+106 added−71 removed

7 files+225 added−93 removed

modified:lib/stdio.js+62 added-57 removed
1import {createReadStream, readFileSync} from 'node:fs';1import {createReadStream, createWriteStream, readFileSync, writeFileSync} from 'node:fs';2import {isAbsolute} from 'node:path';3import {Readable, Writable} from 'node:stream';4import {isStream as isNodeStream} from 'is-stream';56const aliases = ['stdin', 'stdout', 'stderr'];76const arrifyStdio = (stdio = []) => Array.isArray(stdio) ? stdio : [stdio, stdio, stdio];78const isIterableStdin = stdinOption => typeof stdinOption === 'object'9 && stdinOption !== null
29 unmodified lines
3940const NO_PIPE_STDIO = new Set(['ipc', 'ignore', 'inherit']);41const KNOWN_STDIO = new Set([...NO_PIPE_STDIO, 'overlapped', 'pipe']);4245const validateFileSdio = stdioOption => {43const validateFileSdio = (stdioOption, optionName) => {44 if (isRegularUrl(stdioOption)) {47 throw new TypeError(`The \`stdin: URL\` option must use the \`file:\` scheme.45 throw new TypeError(`The \`${optionName}: URL\` option must use the \`file:\` scheme.46For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);47 }4849 if (isUnknownStdioString(stdioOption)) {52 throw new TypeError('The `stdin: filePath` option must either be an absolute file path or start with `.`.');50 throw new TypeError(`The \`${optionName}: filePath\` option must either be an absolute file path or start with \`.\`.`);51 }52};5354const validateInputOptions = (stdioArray, input, inputFile) => {
9 unmodified lines
64 if (noPipeStdin && inputFile !== undefined) {65 throw new TypeError('The `inputFile` and `stdin` options cannot be both set.');66 }6770 validateFileSdio(stdioArray[0]);68 validateFileSdio(stdioArray[0], 'stdin');69 validateFileSdio(stdioArray[1], 'stdout');70 validateFileSdio(stdioArray[2], 'stderr');71};7273const getStdioStreams = (stdioArray, {input, inputFile}) => ({74 ...getStdinStream(stdioArray[0], input, inputFile),75 ...getStdoutStream(stdioArray[1]),76 ...getStderrStream(stdioArray[2]),77});73const getStdioStreams = (stdioArray, {input, inputFile}) => [74 {...getStdinStream(stdioArray[0], input, inputFile), isInput: true},75 getOutputStream(stdioArray[1]),76 getOutputStream(stdioArray[2]),77];7879const getStdinStream = (stdinOption, input, inputFile) => {80 const iterableStdin = getIterableStdin(stdinOption);8182 if (iterableStdin !== undefined) {83 return {stdinStream: Readable.from(iterableStdin)};83 return {value: Readable.from(iterableStdin)};84 }8586 if (isReadableStream(stdinOption)) {87 return {stdinStream: Readable.fromWeb(stdinOption)};87 return {value: Readable.fromWeb(stdinOption)};88 }8990 if (isFileUrl(stdinOption) || isFilePath(stdinOption)) {91 return {stdinStream: createReadStream(stdinOption)};91 return {value: createReadStream(stdinOption), finite: true};92 }9394 if (inputFile !== undefined) {95 return {stdinStream: createReadStream(inputFile)};95 return {value: createReadStream(inputFile), finite: true};96 }9798 if (input === undefined) {99 return {};100 }101102 if (isNodeStream(input)) {103 return {stdinStream: input};103 return {value: input};104 }105106 return {stdinInput: input};106 return {value: input, single: true};107};108109const getStdoutStream = stdoutOption => {110 const stdoutStream = getOutputStream(stdoutOption);111 return stdoutStream === undefined ? {} : {stdoutStream};112};113114const getStderrStream = stderrOption => {115 const stderrStream = getOutputStream(stderrOption);116 return stderrStream === undefined ? {} : {stderrStream};117};118109const getOutputStream = stdioOption => {110 if (isWritableStream(stdioOption)) {121 return Writable.fromWeb(stdioOption);111 return {value: Writable.fromWeb(stdioOption)};112 }123};113125// When the `stdin: Iterable | ReadableStream | URL | filePath`, `input` or `inputFile` option is used, we pipe to `spawned.std*`.126// Therefore the `std*` options must be either `pipe` or `overlapped`. Other values do not set `spawned.std*`.127const willPipeStreams = (index, {stdinStream, stdinInput, stdoutStream, stderrStream}) => {128 if (index === 0) {129 return stdinStream !== undefined || stdinInput !== undefined;114 if (isFileUrl(stdioOption) || isFilePath(stdioOption)) {115 return {value: createWriteStream(stdioOption), finite: true};116 }117132 if (index === 1) {133 return stdoutStream !== undefined;134 }135136 if (index === 2) {137 return stderrStream !== undefined;138 }139140 return false;118 return {};119};120121// When the `stdin: Iterable | ReadableStream | URL | filePath`, `input` or `inputFile` option is used, we pipe to `spawned.std*`.122// Therefore the `std*` options must be either `pipe` or `overlapped`. Other values do not set `spawned.std*`.123const transformStdioItem = (stdioItem, index, stdioStreams) =>144 willPipeStreams(index, stdioStreams) && stdioItem !== 'overlapped' ? 'pipe' : stdioItem;124 stdioStreams[index]?.value !== undefined && stdioItem !== 'overlapped' ? 'pipe' : stdioItem;125126const transformStdio = (stdio, stdioStreams) => Array.isArray(stdio)127 ? stdio.map((stdioItem, index) => transformStdioItem(stdioItem, index, stdioStreams))128 : stdio;129150// Handle `input`, `inputFile` and `stdin` options, before spawning, in async mode130// Handle `input`, `inputFile`, `stdin`, `stdout` and `stderr` options, before spawning, in async mode131export const handleStdioOption = options => {132 const stdio = normalizeStdio(options);133 const stdioArray = arrifyStdio(stdio);134 validateInputOptions(stdioArray, options.input, options.inputFile);
1 unmodified line
136 options.stdio = transformStdio(stdio, stdioStreams);137 return stdioStreams;138};139160// Handle `input`, `inputFile` and `stdin` options, after spawning, in async mode161export const pipeStdioOption = (spawned, {stdinStream, stdinInput, stdoutStream, stderrStream}) => {162 if (stdinStream !== undefined) {163 stdinStream.pipe(spawned.stdin);140// Handle `input`, `inputFile`, `stdin`, `stdout` and `stderr` options, after spawning, in async mode141export const pipeStdioOptions = (spawned, stdioStreams) => {142 for (const [index, stdioStream] of stdioStreams.entries()) {143 pipeStdioOption(spawned.stdio[index], stdioStream);144 }145};146166 if (stdinInput !== undefined) {167 spawned.stdin.end(stdinInput);147const pipeStdioOption = (childStream, {single, value, isInput}) => {148 if (value === undefined) {149 return;150 }151170 if (stdoutStream !== undefined) {171 spawned.stdout.pipe(stdoutStream);152 if (!isInput) {153 childStream.pipe(value);154 return;155 }156174 if (stderrStream !== undefined) {175 spawned.stderr.pipe(stderrStream);157 if (single) {158 childStream.end(value);159 return;160 }161162 value.pipe(childStream);163};164165const transformStdioItemSync = stdioItem => isFileUrl(stdioItem) || isFilePath(stdioItem) ? 'pipe' : stdioItem;166
40 unmodified lines
207 return input;208};209210// Handle `input`, `inputFile` and `stdin` options, before spawning, in sync mode225export const handleInputOption = options => {211export const handleInputSync = options => {212 const stdio = normalizeStdio(options);213 const stdioArray = arrifyStdio(stdio);214 validateOptionsSync(stdioArray, options);215
2 unmodified lines
218 options.input = input;219 }220221 options.stdio = transformStdioSync(stdio);222 return stdioArray;223};224225// Handle `stdout` and `stderr` options, before spawning, in sync mode226const handleOutputOption = (stdioOption, result) => {227 if (result === null) {228 return;229 }230231 if (isFileUrl(stdioOption) || isFilePath(stdioOption)) {232 writeFileSync(stdioOption, result);233 }234};235236export const handleOutputSync = (stdioArray, {stdout, stderr}) => {237 handleOutputOption(stdioArray[1], stdout);238 handleOutputOption(stdioArray[2], stderr);239};240241const aliases = ['stdin', 'stdout', 'stderr'];242243const hasAlias = options => aliases.some(alias => options[alias] !== undefined);244245export const normalizeStdio = options => {246 if (!options) {
43 unmodified lines
modified:lib/stream.js+27 added-6 removed
modified:test/stream.js+119 added-22 removed
1import {Buffer} from 'node:buffer';2import {exec} from 'node:child_process';3import process from 'node:process';4import fs from 'node:fs';5import {readFile} from 'node:fs/promises';6import {relative} from 'node:path';7import Stream from 'node:stream';8import {setTimeout} from 'node:timers/promises';9import {promisify} from 'node:util';
8 unmodified lines
18const pExec = promisify(exec);1920setFixtureDir();2122const nonFileUrl = new URL('https://example.com');2324test('buffer', async t => {25 const {stdout} = await execa('noop.js', ['foo'], {encoding: null});26 t.true(Buffer.isBuffer(stdout));27 t.is(stdout.toString(), 'foo');
255 unmodified lines
283284test('stdin can be a file URL', async t => {285 const inputFile = tempfile();286 fs.writeFileSync(inputFile, 'howdy');284 const stdin = pathToFileURL(inputFile);285 const {stdout} = await execa('stdin.js', {stdin});287 const {stdout} = await execa('stdin.js', {stdin: pathToFileURL(inputFile)});288 t.is(stdout, 'howdy');289});290289test('stdin cannot be a non-file URL', async t => {290 await t.throws(() => {291 execa('stdin.js', {stdin: new URL('https://example.com')});291const testOutputFileUrl = async (t, streamName, fixtureName) => {292 const outputFile = tempfile();293 await execa(fixtureName, ['foobar'], {[streamName]: pathToFileURL(outputFile)});294 t.is(await readFile(outputFile, 'utf8'), 'foobar\n');295};296297test('stdout can be a file URL', testOutputFileUrl, 'stdout', 'noop.js');298test('stderr can be a file URL', testOutputFileUrl, 'stderr', 'noop-err.js');299300const testStdioNonFileUrl = (t, streamName, method) => {301 t.throws(() => {302 method('noop.js', {[streamName]: nonFileUrl});303 }, {message: /pathToFileURL/});293});304};305306test('stdin cannot be a non-file URL', testStdioNonFileUrl, 'stdin', execa);307test('stdout cannot be a non-file URL', testStdioNonFileUrl, 'stdout', execa);308test('stderr cannot be a non-file URL', testStdioNonFileUrl, 'stderr', execa);309test('stdin cannot be a non-file URL - sync', testStdioNonFileUrl, 'stdin', execaSync);310test('stdout cannot be a non-file URL - sync', testStdioNonFileUrl, 'stdout', execaSync);311test('stderr cannot be a non-file URL - sync', testStdioNonFileUrl, 'stderr', execaSync);312313test('stdin can be an absolute file path', async t => {314 const inputFile = tempfile();315 fs.writeFileSync(inputFile, 'howdy');316 const {stdout} = await execa('stdin.js', {stdin: inputFile});317 t.is(stdout, 'howdy');318});319320const testOutputAbsoluteFile = async (t, streamName, fixtureName) => {321 const outputFile = tempfile();322 await execa(fixtureName, ['foobar'], {[streamName]: outputFile});323 t.is(await readFile(outputFile, 'utf8'), 'foobar\n');324};325326test('stdout can be an absolute file path', testOutputAbsoluteFile, 'stdout', 'noop.js');327test('stderr can be an absolute file path', testOutputAbsoluteFile, 'stderr', 'noop-err.js');328329test('stdin can be a relative file path', async t => {330 const inputFile = tempfile();331 fs.writeFileSync(inputFile, 'howdy');305 const stdin = relative('.', inputFile);306 const {stdout} = await execa('stdin.js', {stdin});332 const {stdout} = await execa('stdin.js', {stdin: relative('.', inputFile)});333 t.is(stdout, 'howdy');334});335310test('stdin option must start with . when being a relative file path', t => {336const testOutputRelativeFile = async (t, streamName, fixtureName) => {337 const outputFile = tempfile();338 await execa(fixtureName, ['foobar'], {[streamName]: relative('.', outputFile)});339 t.is(await readFile(outputFile, 'utf8'), 'foobar\n');340};341342test('stdout can be a relative file path', testOutputRelativeFile, 'stdout', 'noop.js');343test('stderr can be a relative file path', testOutputRelativeFile, 'stderr', 'noop-err.js');344345const testStdioValidUrl = (t, streamName, method) => {346 t.throws(() => {312 execa('stdin.js', {stdin: 'foobar'});347 method('noop.js', {[streamName]: 'foobar'});348 }, {message: /absolute file path/});314});349};350351test('stdin must start with . when being a relative file path', testStdioValidUrl, 'stdin', execa);352test('stdout must start with . when being a relative file path', testStdioValidUrl, 'stdout', execa);353test('stderr must start with . when being a relative file path', testStdioValidUrl, 'stderr', execa);354test('stdin must start with . when being a relative file path - sync', testStdioValidUrl, 'stdin', execaSync);355test('stdout must start with . when being a relative file path - sync', testStdioValidUrl, 'stdout', execaSync);356test('stderr must start with . when being a relative file path - sync', testStdioValidUrl, 'stderr', execaSync);357358test('inputFile can be set', async t => {359 const inputFile = tempfile();360 fs.writeFileSync(inputFile, 'howdy');361 const {stdout} = await execa('stdin.js', {inputFile});
18 unmodified lines
380 execa('stdin.js', {inputFile: '', stdin: 'ignore'});381 }, {message: /`inputFile` and `stdin` options/});382});383342test('stdin file URL errors should be handled', async t => {343 await t.throwsAsync(execa('stdin.js', {stdin: pathToFileURL('unknown')}), {code: 'ENOENT'});344});384const testFileUrlError = async (t, streamName) => {385 await t.throwsAsync(386 execa('noop.js', {[streamName]: pathToFileURL('./unknown/file')}),387 {code: 'ENOENT'},388 );389};390346test('stdin file path errors should be handled', async t => {347 await t.throwsAsync(execa('stdin.js', {stdin: './unknown'}), {code: 'ENOENT'});348});391test('stdin file URL errors should be handled', testFileUrlError, 'stdin');392test('stdout file URL errors should be handled', testFileUrlError, 'stdout');393test('stderr file URL errors should be handled', testFileUrlError, 'stderr');394395const testFileUrlErrorSync = (t, streamName) => {396 t.throws(() => {397 execaSync('noop.js', {[streamName]: pathToFileURL('./unknown/file')});398 }, {code: 'ENOENT'});399};400401test('stdin file URL errors should be handled - sync', testFileUrlErrorSync, 'stdin');402test('stdout file URL errors should be handled - sync', testFileUrlErrorSync, 'stdout');403test('stderr file URL errors should be handled - sync', testFileUrlErrorSync, 'stderr');404405const testFilePathError = async (t, streamName) => {406 await t.throwsAsync(407 execa('noop.js', {[streamName]: './unknown/file'}),408 {code: 'ENOENT'},409 );410};411412test('stdin file path errors should be handled', testFilePathError, 'stdin');413test('stdout file path errors should be handled', testFilePathError, 'stdout');414test('stderr file path errors should be handled', testFilePathError, 'stderr');415416const testFilePathErrorSync = (t, streamName) => {417 t.throws(() => {418 execaSync('noop.js', {[streamName]: './unknown/file'});419 }, {code: 'ENOENT'});420};421422test('stdin file path errors should be handled - sync', testFilePathErrorSync, 'stdin');423test('stdout file path errors should be handled - sync', testFilePathErrorSync, 'stdout');424test('stderr file path errors should be handled - sync', testFilePathErrorSync, 'stderr');425426test('inputFile errors should be handled', async t => {427 await t.throwsAsync(execa('stdin.js', {inputFile: 'unknown'}), {code: 'ENOENT'});428});429
56 unmodified lines
486 const {stdout} = execaSync('stdin.js', {stdin});487 t.is(stdout, 'howdy');488});489490const testOutputFileUrlSync = (t, streamName, fixtureName) => {491 const outputFile = tempfile();492 execaSync(fixtureName, ['foobar'], {[streamName]: pathToFileURL(outputFile)});493 t.is(fs.readFileSync(outputFile, 'utf8'), 'foobar\n');494};495496test('stdout can be a file URL - sync', testOutputFileUrlSync, 'stdout', 'noop.js');497test('stderr can be a file URL - sync', testOutputFileUrlSync, 'stderr', 'noop-err.js');498499test('stdin can be an absolute file path - sync', t => {500 const inputFile = tempfile();501 fs.writeFileSync(inputFile, 'howdy');502 const {stdout} = execaSync('stdin.js', {stdin: inputFile});503 t.is(stdout, 'howdy');504});505506const testOutputAbsoluteFileSync = (t, streamName, fixtureName) => {507 const outputFile = tempfile();508 execaSync(fixtureName, ['foobar'], {[streamName]: outputFile});509 t.is(fs.readFileSync(outputFile, 'utf8'), 'foobar\n');510};511512test('stdout can be an absolute file path - sync', testOutputAbsoluteFileSync, 'stdout', 'noop.js');513test('stderr can be an absolute file path - sync', testOutputAbsoluteFileSync, 'stderr', 'noop-err.js');514515test('stdin can be a relative file path - sync', t => {516 const inputFile = tempfile();517 fs.writeFileSync(inputFile, 'howdy');518 const stdin = relative('.', inputFile);519 const {stdout} = execaSync('stdin.js', {stdin});520 t.is(stdout, 'howdy');521});522429test('stdin cannot be a non-file URL - sync', async t => {430 await t.throws(() => {431 execaSync('stdin.js', {stdin: new URL('https://example.com')});432 }, {message: /pathToFileURL/});433});523const testOutputRelativeFileSync = (t, streamName, fixtureName) => {524 const outputFile = tempfile();525 execaSync(fixtureName, ['foobar'], {[streamName]: relative('.', outputFile)});526 t.is(fs.readFileSync(outputFile, 'utf8'), 'foobar\n');527};528529test('stdout can be a relative file path - sync', testOutputRelativeFileSync, 'stdout', 'noop.js');530test('stderr can be a relative file path - sync', testOutputRelativeFileSync, 'stderr', 'noop-err.js');531532test('inputFile can be set - sync', t => {533 const inputFile = tempfile();534 fs.writeFileSync(inputFile, 'howdy');535 const {stdout} = execaSync('stdin.js', {inputFile});
152 unmodified lines
modified:index.d.ts+4 added-2 removed
20 unmodified lines
21 | ReadableStream;2223export type StdoutStderrOption =24 | StdioOption25 | URL26 | string27 | WritableStream;2829type EncodingOption =30 | 'utf8'
77 unmodified lines
108109 /**110 Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).111110 It can also be a web stream ([`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream)), unless [`execaSync()`](#execasyncfile-arguments-options) is used.112 It can also be a file path, a file URL, a web stream ([`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream)), unless [`execaSync()`](#execasyncfile-arguments-options) is used. If the file path is relative, it must start with `.`.113114 @default 'pipe'115 */116 readonly stdout?: StdoutStderrOption;117118 /**119 Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).120119 It can also be a web stream ([`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream)), unless [`execaSync()`](#execasyncfile-arguments-options) is used.121 It can also be a file path, a file URL, a web stream ([`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream)), unless [`execaSync()`](#execasyncfile-arguments-options) is used. If the file path is relative, it must start with `.`.122123 @default 'pipe'124 */125 readonly stderr?: StdoutStderrOption;
890 unmodified lines
modified:index.js+4 added-3 removed
5 unmodified lines
6import stripFinalNewline from 'strip-final-newline';7import {npmRunPathEnv} from 'npm-run-path';8import onetime from 'onetime';9import {makeError} from './lib/error.js';10import {handleStdioOption, handleInputOption, pipeStdioOption, normalizeStdioNode} from './lib/stdio.js';10import {handleStdioOption, handleInputSync, handleOutputSync, pipeStdioOptions, normalizeStdioNode} from './lib/stdio.js';11import {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} from './lib/kill.js';12import {addPipeMethods} from './lib/pipe.js';13import {getSpawnedResult, makeAllStream} from './lib/stream.js';14import {mergePromise, getSpawnedPromise} from './lib/promise.js';
142 unmodified lines
157 };158159 const handlePromiseOnce = onetime(handlePromise);160161 pipeStdioOption(spawned, stdioStreams);161 pipeStdioOptions(spawned, stdioStreams);162163 spawned.all = makeAllStream(spawned, parsed.options);164165 addPipeMethods(spawned);
2 unmodified lines
168}169170export function execaSync(file, args, options) {171 const parsed = handleArguments(file, args, options);172 handleInputOption(parsed.options);172 const stdioArray = handleInputSync(parsed.options);173174 const command = joinCommand(file, args);175 const escapedCommand = getEscapedCommand(file, args);176 logCommand(escapedCommand, parsed.options);
15 unmodified lines
192 killed: false,193 });194 }195196 handleOutputSync(stdioArray, result);197 const stdout = handleOutput(parsed.options, result.stdout, result.error);198 const stderr = handleOutput(parsed.options, result.stderr, result.error);199200 if (result.error || result.status !== 0 || result.signal !== null) {
111 unmodified lines
modified:index.test-d.ts+4 added
174 unmodified lines
175execa('unicorns', {stdout: 'ignore'});176execa('unicorns', {stdout: 'inherit'});177execa('unicorns', {stdout: process.stdout});178execa('unicorns', {stdout: new WritableStream()});179execa('unicorns', {stdout: new URL('file:///test')});180execa('unicorns', {stdout: './test'});181execa('unicorns', {stdout: 1});182execa('unicorns', {stdout: undefined});183execa('unicorns', {stderr: 'pipe'});184execa('unicorns', {stderr: 'overlapped'});
1 unmodified line
186execa('unicorns', {stderr: 'ignore'});187execa('unicorns', {stderr: 'inherit'});188execa('unicorns', {stderr: process.stderr});189execa('unicorns', {stderr: new WritableStream()});190execa('unicorns', {stderr: new URL('file:///test')});191execa('unicorns', {stderr: './test'});192execa('unicorns', {stderr: 1});193execa('unicorns', {stderr: undefined});194execa('unicorns', {all: true});195execa('unicorns', {reject: false});
179 unmodified lines
modified:readme.md+5 added-3 removed
566 unmodified lines
567It can also be a file path, a file URL, a web stream ([`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)), an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol) or an [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols), unless either [`execaSync()`](#execasyncfile-arguments-options), the [`input` option](#input) or the [`inputFile` option](#inputfile) is used. If the file path is relative, it must start with `.`.568569#### stdout570571Type: `string | number | stream.Writable | WritableStream | undefined`\571Type: `string | number | stream.Writable | WritableStream | undefined | URL`\572Default: `pipe`573574Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).575576It can also be a web stream ([`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream)), unless [`execaSync()`](#execasyncfile-arguments-options) is used.576It can also be a file path, a file URL, a web stream ([`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream)), unless [`execaSync()`](#execasyncfile-arguments-options) is used. If the file path is relative, it must start with `.`.577578#### stderr579580Type: `string | number | stream.Writable | WritableStream | undefined`\580Type: `string | number | stream.Writable | WritableStream | undefined | URL`\581Default: `pipe`582583Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).584585It can also be a file path, a file URL, a web stream ([`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream)), unless [`execaSync()`](#execasyncfile-arguments-options) is used. If the file path is relative, it must start with `.`.586587#### all588589Type: `boolean`\590Default: `false`
227 unmodified lines