Skip to content
Myr

Fix `stdio` option (#634)

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

authored by ehmicky · committed by GitHub · parent b495146 · Browse files · 13 files+186 added−45 removed
This commit

State

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

Diff stats

13 files+186 added−45 removed

  • tests:+57 added−5 removed
  • other:+129 added−40 removed

13 files+186 added−45 removed

modified:lib/stdio/handle.js+18 added-11 removed
modified:lib/stdio/sync.js+9 added
modified:lib/stdio/type.js+16 added-1 removed
added:test/fixtures/noop-fd3.js+6 added
added:test/fixtures/stdin-fd3.js+6 added
modified:test/helpers/stdio.js+1 added
modified:test/stdio/file-descriptor.js+5 added-1 removed
1 unmodified line
2import test from 'ava';3import tempfile from 'tempfile';4import {execa, execaSync} from '../../index.js';5import {setFixtureDir} from '../helpers/fixtures-dir.js';6import {getStdinOption, getStdoutOption, getStderrOption} from '../helpers/stdio.js';6import {getStdinOption, getStdoutOption, getStderrOption, getStdioOption} from '../helpers/stdio.js';78setFixtureDir();910const getStdinProp = ({stdin}) => stdin;11const getStdioProp = ({stdio}) => stdio[3];1213const testFileDescriptorOption = async (t, fixtureName, getOptions, execaMethod) => {14 const filePath = tempfile();15 const fileDescriptor = await open(filePath, 'w');
3 unmodified lines
19};2021test('pass `stdout` to a file descriptor', testFileDescriptorOption, 'noop.js', getStdoutOption, execa);22test('pass `stderr` to a file descriptor', testFileDescriptorOption, 'noop-err.js', getStderrOption, execa);23test('pass `stdio[*]` to a file descriptor', testFileDescriptorOption, 'noop-fd3.js', getStdioOption, execa);24test('pass `stdout` to a file descriptor - sync', testFileDescriptorOption, 'noop.js', getStdoutOption, execaSync);25test('pass `stderr` to a file descriptor - sync', testFileDescriptorOption, 'noop-err.js', getStderrOption, execaSync);26test('pass `stdio[*]` to a file descriptor - sync', testFileDescriptorOption, 'noop-fd3.js', getStdioOption, execaSync);2728const testStdinWrite = async (t, getStreamProp, fixtureName, getOptions) => {29 const subprocess = execa(fixtureName, getOptions('pipe'));30 getStreamProp(subprocess).end('unicorns');
1 unmodified line
32 t.is(stdout, 'unicorns');33};3435test('you can write to child.stdin', testStdinWrite, getStdinProp, 'stdin.js', getStdinOption);36test('you can write to child.stdio[*]', testStdinWrite, getStdioProp, 'stdin-fd3.js', getStdioOption);
modified:test/stdio/file-path.js+15 added-1 removed
4 unmodified lines
5import test from 'ava';6import tempfile from 'tempfile';7import {execa, execaSync, $} from '../../index.js';8import {setFixtureDir} from '../helpers/fixtures-dir.js';9import {getStdinOption, getStdoutOption, getStderrOption, getInputFileOption, getScriptSync, identity} from '../helpers/stdio.js';9import {getStdinOption, getStdoutOption, getStderrOption, getStdioOption, getInputFileOption, getScriptSync, identity} from '../helpers/stdio.js';1011setFixtureDir();1213const nonFileUrl = new URL('https://example.com');
30 unmodified lines
44};4546test('stdout can be a file URL', testOutputFile, pathToFileURL, 'noop.js', getStdoutOption, execa);47test('stderr can be a file URL', testOutputFile, pathToFileURL, 'noop-err.js', getStderrOption, execa);48test('stdio[*] can be a file URL', testOutputFile, pathToFileURL, 'noop-fd3.js', getStdioOption, execa);49test('stdout can be an absolute file path', testOutputFile, identity, 'noop.js', getStdoutOption, execa);50test('stderr can be an absolute file path', testOutputFile, identity, 'noop-err.js', getStderrOption, execa);51test('stdio[*] can be an absolute file path', testOutputFile, identity, 'noop-fd3.js', getStdioOption, execa);52test('stdout can be a relative file path', testOutputFile, getRelativePath, 'noop.js', getStdoutOption, execa);53test('stderr can be a relative file path', testOutputFile, getRelativePath, 'noop-err.js', getStderrOption, execa);54test('stdio[*] can be a relative file path', testOutputFile, getRelativePath, 'noop-fd3.js', getStdioOption, execa);55test('stdout can be a file URL - sync', testOutputFile, pathToFileURL, 'noop.js', getStdoutOption, execaSync);56test('stderr can be a file URL - sync', testOutputFile, pathToFileURL, 'noop-err.js', getStderrOption, execaSync);57test('stdio[*] can be a file URL - sync', testOutputFile, pathToFileURL, 'noop-fd3.js', getStdioOption, execaSync);58test('stdout can be an absolute file path - sync', testOutputFile, identity, 'noop.js', getStdoutOption, execaSync);59test('stderr can be an absolute file path - sync', testOutputFile, identity, 'noop-err.js', getStderrOption, execaSync);60test('stdio[*] can be an absolute file path - sync', testOutputFile, identity, 'noop-fd3.js', getStdioOption, execaSync);61test('stdout can be a relative file path - sync', testOutputFile, getRelativePath, 'noop.js', getStdoutOption, execaSync);62test('stderr can be a relative file path - sync', testOutputFile, getRelativePath, 'noop-err.js', getStderrOption, execaSync);63test('stdio[*] can be a relative file path - sync', testOutputFile, getRelativePath, 'noop-fd3.js', getStdioOption, execaSync);6465const testStdioNonFileUrl = (t, getOptions, execaMethod) => {66 t.throws(() => {67 execaMethod('noop.js', getOptions(nonFileUrl));
3 unmodified lines
71test('inputFile cannot be a non-file URL', testStdioNonFileUrl, getInputFileOption, execa);72test('stdin cannot be a non-file URL', testStdioNonFileUrl, getStdinOption, execa);73test('stdout cannot be a non-file URL', testStdioNonFileUrl, getStdoutOption, execa);74test('stderr cannot be a non-file URL', testStdioNonFileUrl, getStderrOption, execa);75test('stdio[*] cannot be a non-file URL', testStdioNonFileUrl, getStdioOption, execa);76test('inputFile cannot be a non-file URL - sync', testStdioNonFileUrl, getInputFileOption, execaSync);77test('stdin cannot be a non-file URL - sync', testStdioNonFileUrl, getStdinOption, execaSync);78test('stdout cannot be a non-file URL - sync', testStdioNonFileUrl, getStdoutOption, execaSync);79test('stderr cannot be a non-file URL - sync', testStdioNonFileUrl, getStderrOption, execaSync);80test('stdio[*] cannot be a non-file URL - sync', testStdioNonFileUrl, getStdioOption, execaSync);8182const testInputFileValidUrl = async (t, execaMethod) => {83 const filePath = tempfile();84 await writeFile(filePath, 'foobar');
20 unmodified lines
105106test('stdin must start with . when being a relative file path', testStdioValidUrl, getStdinOption, execa);107test('stdout must start with . when being a relative file path', testStdioValidUrl, getStdoutOption, execa);108test('stderr must start with . when being a relative file path', testStdioValidUrl, getStderrOption, execa);109test('stdio[*] must start with . when being a relative file path', testStdioValidUrl, getStdioOption, execa);110test('stdin must start with . when being a relative file path - sync', testStdioValidUrl, getStdinOption, execaSync);111test('stdout must start with . when being a relative file path - sync', testStdioValidUrl, getStdoutOption, execaSync);112test('stderr must start with . when being a relative file path - sync', testStdioValidUrl, getStderrOption, execaSync);113test('stdio[*] must start with . when being a relative file path - sync', testStdioValidUrl, getStdioOption, execaSync);114115const testFileError = async (t, mapFile, getOptions) => {116 await t.throwsAsync(117 execa('noop.js', getOptions(mapFile('./unknown/file'))),
4 unmodified lines
122test('inputFile file URL errors should be handled', testFileError, pathToFileURL, getInputFileOption);123test('stdin file URL errors should be handled', testFileError, pathToFileURL, getStdinOption);124test('stdout file URL errors should be handled', testFileError, pathToFileURL, getStdoutOption);125test('stderr file URL errors should be handled', testFileError, pathToFileURL, getStderrOption);126test('stdio[*] file URL errors should be handled', testFileError, pathToFileURL, getStdioOption);127test('inputFile file path errors should be handled', testFileError, identity, getInputFileOption);128test('stdin file path errors should be handled', testFileError, identity, getStdinOption);129test('stdout file path errors should be handled', testFileError, identity, getStdoutOption);130test('stderr file path errors should be handled', testFileError, identity, getStderrOption);131test('stdio[*] file path errors should be handled', testFileError, identity, getStdioOption);132133const testFileErrorSync = (t, mapFile, getOptions) => {134 t.throws(() => {135 execaSync('noop.js', getOptions(mapFile('./unknown/file')));
3 unmodified lines
139test('inputFile file URL errors should be handled - sync', testFileErrorSync, pathToFileURL, getInputFileOption);140test('stdin file URL errors should be handled - sync', testFileErrorSync, pathToFileURL, getStdinOption);141test('stdout file URL errors should be handled - sync', testFileErrorSync, pathToFileURL, getStdoutOption);142test('stderr file URL errors should be handled - sync', testFileErrorSync, pathToFileURL, getStderrOption);143test('stdio[*] file URL errors should be handled - sync', testFileErrorSync, pathToFileURL, getStdioOption);144test('inputFile file path errors should be handled - sync', testFileErrorSync, identity, getInputFileOption);145test('stdin file path errors should be handled - sync', testFileErrorSync, identity, getStdinOption);146test('stdout file path errors should be handled - sync', testFileErrorSync, identity, getStdoutOption);147test('stderr file path errors should be handled - sync', testFileErrorSync, identity, getStderrOption);148test('stdio[*] file path errors should be handled - sync', testFileErrorSync, identity, getStdioOption);149150const testInputFile = async (t, execaMethod) => {151 const inputFile = tempfile();152 await writeFile(inputFile, 'foobar');
24 unmodified lines
modified:test/stdio/iterable.js+8 added-1 removed
1import test from 'ava';2import {execa, execaSync} from '../../index.js';3import {setFixtureDir} from '../helpers/fixtures-dir.js';4import {getStdinOption, getStdoutOption, getStderrOption} from '../helpers/stdio.js';4import {getStdinOption, getStdoutOption, getStderrOption, getStdioOption} from '../helpers/stdio.js';56setFixtureDir();78const textEncoder = new TextEncoder();
18 unmodified lines
27 t.is(stdout, 'foobar');28};2930test('stdin option can be a sync iterable of strings', testIterable, ['foo', 'bar'], 'stdin.js', getStdinOption);31test('stdio[*] option can be a sync iterable of strings', testIterable, ['foo', 'bar'], 'stdin-fd3.js', getStdioOption);32test('stdin option can be a sync iterable of Uint8Arrays', testIterable, [binaryFoo, binaryBar], 'stdin.js', getStdinOption);33test('stdio[*] option can be a sync iterable of Uint8Arrays', testIterable, [binaryFoo, binaryBar], 'stdin-fd3.js', getStdioOption);34test('stdin option can be an sync iterable of strings', testIterable, stringGenerator(), 'stdin.js', getStdinOption);35test('stdio[*] option can be an sync iterable of strings', testIterable, stringGenerator(), 'stdin-fd3.js', getStdioOption);36test('stdin option can be an sync iterable of Uint8Arrays', testIterable, binaryGenerator(), 'stdin.js', getStdinOption);37test('stdio[*] option can be an sync iterable of Uint8Arrays', testIterable, binaryGenerator(), 'stdin-fd3.js', getStdioOption);3839const testIterableSync = (t, stdioOption, fixtureName, getOptions) => {40 t.throws(() => {41 execaSync(fixtureName, getOptions(stdioOption));42 }, {message: /an iterable in sync mode/});43};4445test('stdin option cannot be a sync iterable - sync', testIterableSync, ['foo', 'bar'], 'stdin.js', getStdinOption);46test('stdio[*] option cannot be a sync iterable - sync', testIterableSync, ['foo', 'bar'], 'stdin-fd3.js', getStdioOption);47test('stdin option cannot be an async iterable - sync', testIterableSync, stringGenerator(), 'stdin.js', getStdinOption);48test('stdio[*] option cannot be an async iterable - sync', testIterableSync, stringGenerator(), 'stdin-fd3.js', getStdioOption);4950const testIterableError = async (t, fixtureName, getOptions) => {51 const {originalMessage} = await t.throwsAsync(execa(fixtureName, getOptions(throwingGenerator())));52 t.is(originalMessage, 'generator error');53};5455test('stdin option handles errors in iterables', testIterableError, 'stdin.js', getStdinOption);56test('stdio[*] option handles errors in iterables', testIterableError, 'stdin-fd3.js', getStdioOption);5758const testNoIterableOutput = (t, getOptions, execaMethod) => {59 t.throws(() => {60 execaMethod('noop.js', getOptions(['foo', 'bar']));
7 unmodified lines
modified:test/stdio/node-stream.js+10 added-1 removed
4 unmodified lines
5import test from 'ava';6import tempfile from 'tempfile';7import {execa, execaSync} from '../../index.js';8import {setFixtureDir} from '../helpers/fixtures-dir.js';9import {getStdinOption, getStdoutOption, getStderrOption, getInputOption} from '../helpers/stdio.js';9import {getStdinOption, getStdoutOption, getStderrOption, getStdioOption, getInputOption} from '../helpers/stdio.js';1011setFixtureDir();1213const createNoFileReadable = value => {
9 unmodified lines
23 }, {message: `The \`${optionName}\` option cannot be a Node.js stream in sync mode.`});24};2526test('input cannot be a Node.js Readable - sync', testNodeStreamSync, Readable, getInputOption, 'input');27test('stdin cannot be a Node.js Readable - sync', testNodeStreamSync, Readable, getStdinOption, 'stdin');28test('stdio[*] cannot be a Node.js Readable - sync', testNodeStreamSync, Readable, getStdioOption, 'stdio[3]');29test('stdout cannot be a Node.js Writable - sync', testNodeStreamSync, Writable, getStdoutOption, 'stdout');30test('stderr cannot be a Node.js Writable - sync', testNodeStreamSync, Writable, getStderrOption, 'stderr');31test('stdio[*] cannot be a Node.js Writable - sync', testNodeStreamSync, Writable, getStdioOption, 'stdio[3]');3233test('input can be a Node.js Readable without a file descriptor', async t => {34 const {stdout} = await execa('stdin.js', {input: createNoFileReadable('foobar')});35 t.is(stdout, 'foobar');
5 unmodified lines
4142test('stdin cannot be a Node.js Readable without a file descriptor', testNoFileStream, getStdinOption, Readable);43test('stdout cannot be a Node.js Writable without a file descriptor', testNoFileStream, getStdoutOption, Writable);44test('stderr cannot be a Node.js Writable without a file descriptor', testNoFileStream, getStderrOption, Writable);45test('stdio[*] cannot be a Node.js Readable without a file descriptor', testNoFileStream, getStdioOption, Readable);46test('stdio[*] cannot be a Node.js Writable without a file descriptor', testNoFileStream, getStdioOption, Writable);4748const testFileReadable = async (t, fixtureName, getOptions) => {49 const filePath = tempfile();50 await writeFile(filePath, 'foobar');
7 unmodified lines
58};5960test('input can be a Node.js Readable with a file descriptor', testFileReadable, 'stdin.js', getInputOption);61test('stdin can be a Node.js Readable with a file descriptor', testFileReadable, 'stdin.js', getStdinOption);62test('stdio[*] can be a Node.js Readable with a file descriptor', testFileReadable, 'stdin-fd3.js', getStdioOption);6364const testFileWritable = async (t, getOptions, fixtureName) => {65 const filePath = tempfile();66 const stream = createWriteStream(filePath);
6 unmodified lines
73};7475test('stdout can be a Node.js Writable with a file descriptor', testFileWritable, getStdoutOption, 'noop.js');76test('stderr can be a Node.js Writable with a file descriptor', testFileWritable, getStderrOption, 'noop-err.js');77test('stdio[*] can be a Node.js Writable with a file descriptor', testFileWritable, getStdioOption, 'noop-fd3.js');
modified:test/stdio/web-stream.js+6 added-1 removed
1import {Readable} from 'node:stream';2import test from 'ava';3import {execa, execaSync} from '../../index.js';4import {setFixtureDir} from '../helpers/fixtures-dir.js';5import {getStdinOption, getStdoutOption, getStderrOption} from '../helpers/stdio.js';5import {getStdinOption, getStdoutOption, getStderrOption, getStdioOption} from '../helpers/stdio.js';67setFixtureDir();89const testReadableStream = async (t, fixtureName, getOptions) => {
2 unmodified lines
12 t.is(stdout, 'foobar');13};1415test('stdin can be a ReadableStream', testReadableStream, 'stdin.js', getStdinOption);16test('stdio[*] can be a ReadableStream', testReadableStream, 'stdin-fd3.js', getStdioOption);1718const testWritableStream = async (t, fixtureName, getOptions) => {19 const result = [];20 const writableStream = new WritableStream({
6 unmodified lines
27};2829test('stdout can be a WritableStream', testWritableStream, 'noop.js', getStdoutOption);30test('stderr can be a WritableStream', testWritableStream, 'noop-err.js', getStderrOption);31test('stdio[*] can be a WritableStream', testWritableStream, 'noop-fd3.js', getStdioOption);3233const testWebStreamSync = (t, StreamClass, getOptions, optionName) => {34 t.throws(() => {35 execaSync('noop.js', getOptions(new StreamClass()));36 }, {message: `The \`${optionName}\` option cannot be a web stream in sync mode.`});37};3839test('stdin cannot be a ReadableStream - sync', testWebStreamSync, ReadableStream, getStdinOption, 'stdin');40test('stdio[*] cannot be a ReadableStream - sync', testWebStreamSync, ReadableStream, getStdioOption, 'stdio[3]');41test('stdout cannot be a WritableStream - sync', testWebStreamSync, WritableStream, getStdoutOption, 'stdout');42test('stderr cannot be a WritableStream - sync', testWebStreamSync, WritableStream, getStderrOption, 'stderr');43test('stdio[*] cannot be a WritableStream - sync', testWebStreamSync, WritableStream, getStdioOption, 'stdio[3]');4445const testWritableStreamError = async (t, getOptions) => {46 const writableStream = new WritableStream({47 start(controller) {
5 unmodified lines
53};5455test('stdout option handles errors in WritableStream', testWritableStreamError, getStdoutOption);56test('stderr option handles errors in WritableStream', testWritableStreamError, getStderrOption);57test('stdio[*] option handles errors in WritableStream', testWritableStreamError, getStdioOption);
modified:index.d.ts+23 added-15 removed
1import {type ChildProcess} from 'node:child_process';2import {type Stream, type Readable, type Writable} from 'node:stream';2import {type Readable, type Writable} from 'node:stream';34export type StdioOption =4type BaseStdioOption =5 | 'pipe'6 | 'overlapped'7 | 'ipc'7 | 'ignore'9 | 'inherit'10 | Stream8 | 'inherit';910type CommonStdioOption =11 | BaseStdioOption12 | 'ipc'13 | number12 | undefined;14 | undefined15 | URL16 | string;1714export type StdinOption =15 | StdioOption18type InputStdioOption =19 | Iterable<string | Uint8Array>20 | AsyncIterable<string | Uint8Array>18 | URL19 | string21 | Readable22 | ReadableStream;2322export type StdoutStderrOption =23 | StdioOption24 | URL25 | string24type OutputStdioOption =25 | Writable26 | WritableStream;2728export type StdinOption = CommonStdioOption | InputStdioOption;29export type StdoutStderrOption = CommonStdioOption | OutputStdioOption;30export type StdioOption = CommonStdioOption | InputStdioOption | OutputStdioOption;3132type StdioOptions =33 | BaseStdioOption34 | readonly [StdinOption, StdoutStderrOption, StdoutStderrOption, ...StdioOption[]];3536type EncodingOption =37 | 'utf8'38 // eslint-disable-next-line unicorn/text-encoding-identifier-case39 | 'utf-8'
175 unmodified lines
215 - an array with more than 3 values, to create more than 3 file descriptors.216217 @default 'pipe'218 */211 readonly stdio?: 'pipe' | 'overlapped' | 'ignore' | 'inherit' | readonly StdioOption[];219 readonly stdio?: StdioOptions;220221 /**222 Specify the kind of serialization used for sending messages between processes when using the `stdio: 'ipc'` option or `execaNode()`:223 - `json`: Uses `JSON.stringify()` and `JSON.parse()`.
846 unmodified lines
modified:index.test-d.ts+63 added-13 removed
1// For some reason a default import of `process` causes2// `process.stdin`, `process.stderr`, and `process.stdout`3// to get treated as `any` by `@typescript-eslint/no-unsafe-assignment`.4import * as process from 'node:process';5import {type Readable} from 'node:stream';5import {Readable, Writable} from 'node:stream';6import {createWriteStream} from 'node:fs';7import {expectType, expectError, expectAssignable} from 'tsd';8import {9 $,
128 unmodified lines
138const numberGenerator = function * () {139 yield 0;140};141142const asyncStringGenerator = async function * () {143 yield '';144};145146const fileUrl = new URL('file:///test');147148/* eslint-disable @typescript-eslint/no-floating-promises */149execa('unicorns', {cleanup: false});150execa('unicorns', {preferLocal: false});151execa('unicorns', {localDir: '.'});146execa('unicorns', {localDir: new URL('file:///test')});152execa('unicorns', {localDir: fileUrl});153expectError(execa('unicorns', {encoding: 'unknownEncoding'}));154execa('unicorns', {execPath: '/path'});149execa('unicorns', {execPath: new URL('file:///test')});155execa('unicorns', {execPath: fileUrl});156execa('unicorns', {buffer: false});157execa('unicorns', {input: ''});158execa('unicorns', {input: new Uint8Array()});159execa('unicorns', {input: process.stdin});160execa('unicorns', {inputFile: ''});155execa('unicorns', {inputFile: new URL('file:///test')});161execa('unicorns', {inputFile: fileUrl});162execa('unicorns', {stdin: 'pipe'});163execa('unicorns', {stdin: 'overlapped'});164execa('unicorns', {stdin: 'ipc'});165execa('unicorns', {stdin: 'ignore'});166execa('unicorns', {stdin: 'inherit'});167execa('unicorns', {stdin: process.stdin});168execa('unicorns', {stdin: new Readable()});169expectError(execa('unicorns', {stdin: new Writable()}));170execa('unicorns', {stdin: new ReadableStream()});171expectError(execa('unicorns', {stdin: new WritableStream()}));172execa('unicorns', {stdin: ['']});173execa('unicorns', {stdin: [new Uint8Array(0)]});174execa('unicorns', {stdin: stringGenerator()});175execa('unicorns', {stdin: binaryGenerator()});176execa('unicorns', {stdin: asyncStringGenerator()});177expectError(execa('unicorns', {stdin: [0]}));178expectError(execa('unicorns', {stdin: numberGenerator()}));169execa('unicorns', {stdin: new URL('file:///test')});179execa('unicorns', {stdin: fileUrl});180execa('unicorns', {stdin: './test'});181execa('unicorns', {stdin: 1});182execa('unicorns', {stdin: undefined});183execa('unicorns', {stdout: 'pipe'});
1 unmodified line
185execa('unicorns', {stdout: 'ipc'});186execa('unicorns', {stdout: 'ignore'});187execa('unicorns', {stdout: 'inherit'});188execa('unicorns', {stdout: process.stdout});189execa('unicorns', {stdout: new Writable()});190expectError(execa('unicorns', {stdout: new Readable()}));191execa('unicorns', {stdout: new WritableStream()});180execa('unicorns', {stdout: new URL('file:///test')});192expectError(execa('unicorns', {stdout: new ReadableStream()}));193execa('unicorns', {stdout: fileUrl});194execa('unicorns', {stdout: './test'});195execa('unicorns', {stdout: 1});196execa('unicorns', {stdout: undefined});197execa('unicorns', {stderr: 'pipe'});
1 unmodified line
199execa('unicorns', {stderr: 'ipc'});200execa('unicorns', {stderr: 'ignore'});201execa('unicorns', {stderr: 'inherit'});202execa('unicorns', {stderr: process.stderr});203execa('unicorns', {stderr: new Writable()});204expectError(execa('unicorns', {stderr: new Readable()}));205execa('unicorns', {stderr: new WritableStream()});191execa('unicorns', {stderr: new URL('file:///test')});206expectError(execa('unicorns', {stderr: new ReadableStream()}));207execa('unicorns', {stderr: fileUrl});208execa('unicorns', {stderr: './test'});209execa('unicorns', {stderr: 1});210execa('unicorns', {stderr: undefined});211execa('unicorns', {all: true});212execa('unicorns', {reject: false});213execa('unicorns', {stripFinalNewline: false});214execa('unicorns', {extendEnv: false});215execa('unicorns', {cwd: '.'});200execa('unicorns', {cwd: new URL('file:///test')});216execa('unicorns', {cwd: fileUrl});217// eslint-disable-next-line @typescript-eslint/naming-convention218execa('unicorns', {env: {PATH: ''}});219execa('unicorns', {argv0: ''});220execa('unicorns', {stdio: 'pipe'});221execa('unicorns', {stdio: 'overlapped'});222execa('unicorns', {stdio: 'ignore'});223execa('unicorns', {stdio: 'inherit'});224expectError(execa('unicorns', {stdio: 'ipc'}));225expectError(execa('unicorns', {stdio: 1}));226expectError(execa('unicorns', {stdio: fileUrl}));227expectError(execa('unicorns', {stdio: './test'}));228expectError(execa('unicorns', {stdio: new Writable()}));229expectError(execa('unicorns', {stdio: new Readable()}));230expectError(execa('unicorns', {stdio: new WritableStream()}));231expectError(execa('unicorns', {stdio: new ReadableStream()}));232expectError(execa('unicorns', {stdio: stringGenerator()}));233expectError(execa('unicorns', {stdio: asyncStringGenerator()}));234expectError(execa('unicorns', {stdio: ['pipe', 'pipe']}));235execa('unicorns', {stdio: [new Readable(), 'pipe', 'pipe']});236execa('unicorns', {stdio: ['pipe', new Writable(), 'pipe']});237execa('unicorns', {stdio: ['pipe', 'pipe', new Writable()]});238expectError(execa('unicorns', {stdio: [new Writable(), 'pipe', 'pipe']}));239expectError(execa('unicorns', {stdio: ['pipe', new Readable(), 'pipe']}));240expectError(execa('unicorns', {stdio: ['pipe', 'pipe', new Readable()]}));241execa('unicorns', {209 stdio: ['pipe', 'overlapped', 'ipc', 'ignore', 'inherit', process.stdin, 1, undefined],242 stdio: [243 'pipe',244 'overlapped',245 'ipc',246 'ignore',247 'inherit',248 process.stdin,249 1,250 undefined,251 fileUrl,252 './test',253 new Writable(),254 new Readable(),255 new WritableStream(),256 new ReadableStream(),257 stringGenerator(),258 asyncStringGenerator(),259 ],260});261execa('unicorns', {serialization: 'advanced'});262execa('unicorns', {detached: true});263execa('unicorns', {uid: 0});
18 unmodified lines
282execa('unicorns').kill('SIGKILL', {forceKillAfterTimeout: undefined});283284expectError(execa(['unicorns', 'arg']));285expectType<ExecaChildProcess>(execa('unicorns'));236expectType<ExecaChildProcess>(execa(new URL('file:///test')));286expectType<ExecaChildProcess>(execa(fileUrl));287expectType<ExecaReturnValue>(await execa('unicorns'));288expectType<ExecaReturnValue>(289 await execa('unicorns', {encoding: 'utf8'}),290);
6 unmodified lines
297);298299expectError(execaSync(['unicorns', 'arg']));300expectType<ExecaSyncReturnValue>(execaSync('unicorns'));251expectType<ExecaSyncReturnValue>(execaSync(new URL('file:///test')));301expectType<ExecaSyncReturnValue>(execaSync(fileUrl));302expectType<ExecaSyncReturnValue>(303 execaSync('unicorns', {encoding: 'utf8'}),304);305expectType<ExecaSyncReturnValue<Uint8Array>>(
21 unmodified lines
327328expectError(execaNode(['unicorns', 'arg']));329expectType<ExecaChildProcess>(execaNode('unicorns'));330expectType<ExecaReturnValue>(await execaNode('unicorns'));281expectType<ExecaReturnValue>(await execaNode(new URL('file:///test')));331expectType<ExecaReturnValue>(await execaNode(fileUrl));332expectType<ExecaReturnValue>(333 await execaNode('unicorns', {encoding: 'utf8'}),334);335expectType<ExecaReturnValue<Uint8Array>>(await execaNode('unicorns', {encoding: 'buffer'}));
4 unmodified lines
340 await execaNode('unicorns', ['foo'], {encoding: 'buffer'}),341);342343expectType<ExecaChildProcess>(execaNode('unicorns', {nodePath: './node'}));294expectType<ExecaChildProcess>(execaNode('unicorns', {nodePath: new URL('file:///test')}));344expectType<ExecaChildProcess>(execaNode('unicorns', {nodePath: fileUrl}));345346expectType<ExecaChildProcess>(execaNode('unicorns', {nodeOptions: ['--async-stack-traces']}));347expectType<ExecaChildProcess>(execaNode('unicorns', ['foo'], {nodeOptions: ['--async-stack-traces']}));348expectType<ExecaChildProcess<Uint8Array>>(
61 unmodified lines