Skip to content
Myr

Fix the type of the return value (#1007)

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

authored by ehmicky · committed by GitHub · parent 4ee0dec · Browse files · 23 files+530 added−501 removed
This commit

State

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

Diff stats

23 files+530 added−501 removed

  • other:+530 added−501 removed

23 files+530 added−501 removed

modified:docs/api.md+21 added-11 removed
13 unmodified lines
1415`file`: `string | URL`\16`arguments`: `string[]`\17`options`: [`Options`](#options)\18_Returns_: [`Subprocess`](#subprocess)18_Returns_: [`ExecaResultPromise`](#return-value)1920Executes a command using `file ...arguments`.2122More info on the [syntax](execution.md#array-syntax) and [escaping](escaping.md#array-syntax).
2 unmodified lines
25### execa(options)\`command\`2627`command`: `string`\28`options`: [`Options`](#options)\29_Returns_: [`Subprocess`](#subprocess)29_Returns_: [`ExecaResultPromise`](#return-value)3031Executes a command. `command` is a [template string](execution.md#template-string-syntax) that includes both the `file` and its `arguments`.3233More info on the [syntax](execution.md#template-string-syntax) and [escaping](escaping.md#template-string-syntax).
9 unmodified lines
4344### execaSync(file, arguments?, options?)45### execaSync\`command\`4647_Returns_: [`ExecaSyncResult`](#return-value)4849Same as [`execa()`](#execafile-arguments-options) but synchronous.5051Returns or throws a subprocess [`result`](#result). The [`subprocess`](#subprocess) is not returned: its methods and properties are not available.52
3 unmodified lines
5657`file`: `string | URL`\58`arguments`: `string[]`\59`options`: [`Options`](#options)\58_Returns_: [`Subprocess`](#subprocess)60_Returns_: [`ExecaResultPromise`](#return-value)6162Same as [`execa()`](#execafile-arguments-options) but using [script-friendly default options](scripts.md#script-files).6364Just like `execa()`, this can use the [template string syntax](execution.md#template-string-syntax) or [bind options](execution.md#globalshared-options). It can also be [run synchronously](#execasyncfile-arguments-options) using `$.sync()` or `$.s()`.
6 unmodified lines
7172`scriptPath`: `string | URL`\73`arguments`: `string[]`\74`options`: [`Options`](#options)\73_Returns_: [`Subprocess`](#subprocess)75_Returns_: [`ExecaResultPromise`](#return-value)7677Same as [`execa()`](#execafile-arguments-options) but using the [`node: true`](#optionsnode) option.78Executes a Node.js file using `node scriptPath ...arguments`.79
6 unmodified lines
86### execaCommand(command, options?)8788`command`: `string`\89`options`: [`Options`](#options)\88_Returns_: [`Subprocess`](#subprocess)90_Returns_: [`ExecaResultPromise`](#return-value)9192Executes a command. `command` is a string that includes both the `file` and its `arguments`.9394This is only intended for very specific cases, such as a [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop). This should be avoided otherwise.
1 unmodified line
96Just like `execa()`, this can [bind options](execution.md#globalshared-options). It can also be [run synchronously](#execasyncfile-arguments-options) using `execaCommandSync()`.9798[More info.](escaping.md#user-defined-input)9998## Subprocess100## Return value101102_Type_: `ExecaResultPromise`103104The return value of all [asynchronous methods](#methods) is both:101- a `Promise` resolving or rejecting with a subprocess [`result`](#result).102- a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with the following methods and properties.105- the [subprocess](#subprocess).106- a `Promise` either resolving with its successful [`result`](#result), or rejecting with its [`error`](#execaerror).107108[More info.](execution.md#subprocess)109110## Subprocess111112_Type_: `ExecaSubprocess`113114[`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with the following methods and properties.115116### subprocess\[Symbol.asyncIterator\]()117118_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)119
35 unmodified lines
155[More info.](pipe.md#template-string-syntax)156157### subprocess.pipe(secondSubprocess, pipeOptions?)158149`secondSubprocess`: [`execa()` return value](#subprocess)\159`secondSubprocess`: [`ExecaResultPromise`](#return-value)\160`pipeOptions`: [`PipeOptions`](#pipeoptions)\161_Returns_: [`Promise<Result>`](#result)162153Like [`subprocess.pipe(file, arguments?, options?)`](#subprocesspipefile-arguments-options) but using the [return value](#subprocess) of another [`execa()`](#execafile-arguments-options) call instead.163Like [`subprocess.pipe(file, arguments?, options?)`](#subprocesspipefile-arguments-options) but using the [return value](#return-value) of another [`execa()`](#execafile-arguments-options) call instead.164165[More info.](pipe.md#advanced-syntax)166167#### pipeOptions
711 unmodified lines
879880Type: `boolean`\881Default: `true`882873Setting this to `false` resolves the [result's promise](#subprocess) with the [error](#execaerror) instead of rejecting it.883Setting this to `false` resolves the [result's promise](#return-value) with the [error](#execaerror) instead of rejecting it.884885[More info.](errors.md#preventing-exceptions)886887### options.timeout
156 unmodified lines
modified:test-d/arguments/options.test-d.ts+4 added-1 removed
modified:test-d/convert/duplex.test-d.ts+20 added-20 removed
1import type {Duplex} from 'node:stream';2import {expectType, expectError} from 'tsd';3import {execa} from '../../index.js';45const execaPromise = execa('unicorns');5const subprocess = execa('unicorns');67expectType<Duplex>(execaPromise.duplex());7expectType<Duplex>(subprocess.duplex());89execaPromise.duplex({from: 'stdout'});10execaPromise.duplex({from: 'stderr'});11execaPromise.duplex({from: 'all'});12execaPromise.duplex({from: 'fd3'});13execaPromise.duplex({from: 'stdout', to: 'stdin'});14execaPromise.duplex({from: 'stdout', to: 'fd3'});15expectError(execaPromise.duplex({from: 'stdin'}));16expectError(execaPromise.duplex({from: 'stderr', to: 'stdout'}));17expectError(execaPromise.duplex({from: 'fd'}));18expectError(execaPromise.duplex({from: 'fdNotANumber'}));19expectError(execaPromise.duplex({to: 'fd'}));20expectError(execaPromise.duplex({to: 'fdNotANumber'}));9subprocess.duplex({from: 'stdout'});10subprocess.duplex({from: 'stderr'});11subprocess.duplex({from: 'all'});12subprocess.duplex({from: 'fd3'});13subprocess.duplex({from: 'stdout', to: 'stdin'});14subprocess.duplex({from: 'stdout', to: 'fd3'});15expectError(subprocess.duplex({from: 'stdin'}));16expectError(subprocess.duplex({from: 'stderr', to: 'stdout'}));17expectError(subprocess.duplex({from: 'fd'}));18expectError(subprocess.duplex({from: 'fdNotANumber'}));19expectError(subprocess.duplex({to: 'fd'}));20expectError(subprocess.duplex({to: 'fdNotANumber'}));2122execaPromise.duplex({binary: false});23expectError(execaPromise.duplex({binary: 'false'}));22subprocess.duplex({binary: false});23expectError(subprocess.duplex({binary: 'false'}));2425execaPromise.duplex({preserveNewlines: false});26expectError(execaPromise.duplex({preserveNewlines: 'false'}));25subprocess.duplex({preserveNewlines: false});26expectError(subprocess.duplex({preserveNewlines: 'false'}));2728expectError(execaPromise.duplex('stdout'));29expectError(execaPromise.duplex({other: 'stdout'}));28expectError(subprocess.duplex('stdout'));29expectError(subprocess.duplex({other: 'stdout'}));
modified:test-d/convert/iterable.test-d.ts+40 added-40 removed
1import {expectType, expectError} from 'tsd';2import {execa} from '../../index.js';34const execaPromise = execa('unicorns');5const execaBufferPromise = execa('unicorns', {encoding: 'buffer', all: true});6const execaHexPromise = execa('unicorns', {encoding: 'hex', all: true});4const subprocess = execa('unicorns');5const bufferSubprocess = execa('unicorns', {encoding: 'buffer', all: true});6const hexSubprocess = execa('unicorns', {encoding: 'hex', all: true});78const asyncIteration = async () => {9 for await (const line of execaPromise) {9 for await (const line of subprocess) {10 expectType<string>(line);11 }1213 for await (const line of execaPromise.iterable()) {13 for await (const line of subprocess.iterable()) {14 expectType<string>(line);15 }1617 for await (const line of execaPromise.iterable({binary: false})) {17 for await (const line of subprocess.iterable({binary: false})) {18 expectType<string>(line);19 }2021 for await (const line of execaPromise.iterable({binary: true})) {21 for await (const line of subprocess.iterable({binary: true})) {22 expectType<Uint8Array>(line);23 }2425 for await (const line of execaPromise.iterable({} as {binary: boolean})) {25 for await (const line of subprocess.iterable({} as {binary: boolean})) {26 expectType<string | Uint8Array>(line);27 }2829 for await (const line of execaBufferPromise) {29 for await (const line of bufferSubprocess) {30 expectType<Uint8Array>(line);31 }3233 for await (const line of execaBufferPromise.iterable()) {33 for await (const line of bufferSubprocess.iterable()) {34 expectType<Uint8Array>(line);35 }3637 for await (const line of execaBufferPromise.iterable({binary: false})) {37 for await (const line of bufferSubprocess.iterable({binary: false})) {38 expectType<Uint8Array>(line);39 }4041 for await (const line of execaBufferPromise.iterable({binary: true})) {41 for await (const line of bufferSubprocess.iterable({binary: true})) {42 expectType<Uint8Array>(line);43 }4445 for await (const line of execaBufferPromise.iterable({} as {binary: boolean})) {45 for await (const line of bufferSubprocess.iterable({} as {binary: boolean})) {46 expectType<Uint8Array>(line);47 }48};4950await asyncIteration();5152expectType<AsyncIterableIterator<string>>(execaPromise.iterable());53expectType<AsyncIterableIterator<string>>(execaPromise.iterable({binary: false}));54expectType<AsyncIterableIterator<Uint8Array>>(execaPromise.iterable({binary: true}));55expectType<AsyncIterableIterator<string | Uint8Array>>(execaPromise.iterable({} as {binary: boolean}));52expectType<AsyncIterableIterator<string>>(subprocess.iterable());53expectType<AsyncIterableIterator<string>>(subprocess.iterable({binary: false}));54expectType<AsyncIterableIterator<Uint8Array>>(subprocess.iterable({binary: true}));55expectType<AsyncIterableIterator<string | Uint8Array>>(subprocess.iterable({} as {binary: boolean}));5657expectType<AsyncIterableIterator<Uint8Array>>(execaBufferPromise.iterable());58expectType<AsyncIterableIterator<Uint8Array>>(execaBufferPromise.iterable({binary: false}));59expectType<AsyncIterableIterator<Uint8Array>>(execaBufferPromise.iterable({binary: true}));60expectType<AsyncIterableIterator<Uint8Array>>(execaBufferPromise.iterable({} as {binary: boolean}));57expectType<AsyncIterableIterator<Uint8Array>>(bufferSubprocess.iterable());58expectType<AsyncIterableIterator<Uint8Array>>(bufferSubprocess.iterable({binary: false}));59expectType<AsyncIterableIterator<Uint8Array>>(bufferSubprocess.iterable({binary: true}));60expectType<AsyncIterableIterator<Uint8Array>>(bufferSubprocess.iterable({} as {binary: boolean}));6162expectType<AsyncIterableIterator<Uint8Array>>(execaHexPromise.iterable());63expectType<AsyncIterableIterator<Uint8Array>>(execaHexPromise.iterable({binary: false}));64expectType<AsyncIterableIterator<Uint8Array>>(execaHexPromise.iterable({binary: true}));65expectType<AsyncIterableIterator<Uint8Array>>(execaHexPromise.iterable({} as {binary: boolean}));62expectType<AsyncIterableIterator<Uint8Array>>(hexSubprocess.iterable());63expectType<AsyncIterableIterator<Uint8Array>>(hexSubprocess.iterable({binary: false}));64expectType<AsyncIterableIterator<Uint8Array>>(hexSubprocess.iterable({binary: true}));65expectType<AsyncIterableIterator<Uint8Array>>(hexSubprocess.iterable({} as {binary: boolean}));6667execaPromise.iterable({});68execaPromise.iterable({from: 'stdout'});69execaPromise.iterable({from: 'stderr'});70execaPromise.iterable({from: 'all'});71execaPromise.iterable({from: 'fd3'});72expectError(execaPromise.iterable({from: 'stdin'}));73expectError(execaPromise.iterable({from: 'fd'}));74expectError(execaPromise.iterable({from: 'fdNotANumber'}));75expectError(execaPromise.iterable({to: 'stdin'}));67subprocess.iterable({});68subprocess.iterable({from: 'stdout'});69subprocess.iterable({from: 'stderr'});70subprocess.iterable({from: 'all'});71subprocess.iterable({from: 'fd3'});72expectError(subprocess.iterable({from: 'stdin'}));73expectError(subprocess.iterable({from: 'fd'}));74expectError(subprocess.iterable({from: 'fdNotANumber'}));75expectError(subprocess.iterable({to: 'stdin'}));7677execaPromise.iterable({binary: false});78expectError(execaPromise.iterable({binary: 'false'}));77subprocess.iterable({binary: false});78expectError(subprocess.iterable({binary: 'false'}));7980execaPromise.iterable({preserveNewlines: false});81expectError(execaPromise.iterable({preserveNewlines: 'false'}));80subprocess.iterable({preserveNewlines: false});81expectError(subprocess.iterable({preserveNewlines: 'false'}));8283expectError(execaPromise.iterable('stdout'));84expectError(execaPromise.iterable({other: 'stdout'}));83expectError(subprocess.iterable('stdout'));84expectError(subprocess.iterable({other: 'stdout'}));
modified:test-d/convert/readable.test-d.ts+16 added-16 removed
1import type {Readable} from 'node:stream';2import {expectType, expectError} from 'tsd';3import {execa} from '../../index.js';45const execaPromise = execa('unicorns');5const subprocess = execa('unicorns');67expectType<Readable>(execaPromise.readable());7expectType<Readable>(subprocess.readable());89execaPromise.readable({from: 'stdout'});10execaPromise.readable({from: 'stderr'});11execaPromise.readable({from: 'all'});12execaPromise.readable({from: 'fd3'});13expectError(execaPromise.readable({from: 'stdin'}));14expectError(execaPromise.readable({from: 'fd'}));15expectError(execaPromise.readable({from: 'fdNotANumber'}));16expectError(execaPromise.readable({to: 'stdin'}));9subprocess.readable({from: 'stdout'});10subprocess.readable({from: 'stderr'});11subprocess.readable({from: 'all'});12subprocess.readable({from: 'fd3'});13expectError(subprocess.readable({from: 'stdin'}));14expectError(subprocess.readable({from: 'fd'}));15expectError(subprocess.readable({from: 'fdNotANumber'}));16expectError(subprocess.readable({to: 'stdin'}));1718execaPromise.readable({binary: false});19expectError(execaPromise.readable({binary: 'false'}));18subprocess.readable({binary: false});19expectError(subprocess.readable({binary: 'false'}));2021execaPromise.readable({preserveNewlines: false});22expectError(execaPromise.readable({preserveNewlines: 'false'}));21subprocess.readable({preserveNewlines: false});22expectError(subprocess.readable({preserveNewlines: 'false'}));2324expectError(execaPromise.readable('stdout'));25expectError(execaPromise.readable({other: 'stdout'}));24expectError(subprocess.readable('stdout'));25expectError(subprocess.readable({other: 'stdout'}));
modified:test-d/convert/writable.test-d.ts+12 added-12 removed
1import type {Writable} from 'node:stream';2import {expectType, expectError} from 'tsd';3import {execa} from '../../index.js';45const execaPromise = execa('unicorns');5const subprocess = execa('unicorns');67expectType<Writable>(execaPromise.writable());7expectType<Writable>(subprocess.writable());89execaPromise.writable({to: 'stdin'});10execaPromise.writable({to: 'fd3'});11expectError(execaPromise.writable({to: 'stdout'}));12expectError(execaPromise.writable({to: 'fd'}));13expectError(execaPromise.writable({to: 'fdNotANumber'}));14expectError(execaPromise.writable({from: 'stdout'}));9subprocess.writable({to: 'stdin'});10subprocess.writable({to: 'fd3'});11expectError(subprocess.writable({to: 'stdout'}));12expectError(subprocess.writable({to: 'fd'}));13expectError(subprocess.writable({to: 'fdNotANumber'}));14expectError(subprocess.writable({from: 'stdout'}));1516expectError(execaPromise.writable({binary: false}));16expectError(subprocess.writable({binary: false}));1718expectError(execaPromise.writable({preserveNewlines: false}));18expectError(subprocess.writable({preserveNewlines: false}));1920expectError(execaPromise.writable('stdin'));21expectError(execaPromise.writable({other: 'stdin'}));20expectError(subprocess.writable('stdin'));21expectError(subprocess.writable({other: 'stdin'}));
modified:test-d/methods/command.test-d.ts+6 added-6 removed
1 unmodified line
2import {3 execaCommand,4 execaCommandSync,5 type ExecaResult,6 type ExecaSubprocess,6 type ExecaResultPromise,7 type ExecaSyncResult,8} from '../../index.js';910const fileUrl = new URL('file:///test');
1 unmodified line
1213expectError(execaCommand());14expectError(execaCommand(true));15expectError(execaCommand(['unicorns', 'arg']));16expectAssignable<ExecaSubprocess>(execaCommand('unicorns'));16expectAssignable<ExecaResultPromise>(execaCommand('unicorns'));17expectError(execaCommand(fileUrl));1819expectError(execaCommand('unicorns', []));20expectError(execaCommand('unicorns', ['foo']));21expectError(execaCommand('unicorns', 'foo'));22expectError(execaCommand('unicorns', [true]));2324expectAssignable<ExecaSubprocess>(execaCommand('unicorns', {}));24expectAssignable<ExecaResultPromise>(execaCommand('unicorns', {}));25expectError(execaCommand('unicorns', [], {}));26expectError(execaCommand('unicorns', [], []));27expectError(execaCommand('unicorns', {other: true}));2829expectAssignable<ExecaSubprocess>(execaCommand`unicorns`);29expectAssignable<ExecaResultPromise>(execaCommand`unicorns`);30expectType<ExecaResult<{}>>(await execaCommand('unicorns'));31expectType<ExecaResult<{}>>(await execaCommand`unicorns`);3233expectAssignable<typeof execaCommand>(execaCommand({}));34expectAssignable<ExecaSubprocess>(execaCommand({})('unicorns'));35expectAssignable<ExecaSubprocess>(execaCommand({})`unicorns`);34expectAssignable<ExecaResultPromise>(execaCommand({})('unicorns'));35expectAssignable<ExecaResultPromise>(execaCommand({})`unicorns`);3637expectAssignable<{stdout: string}>(await execaCommand('unicorns'));38expectAssignable<{stdout: Uint8Array}>(await execaCommand('unicorns', {encoding: 'buffer'}));39expectAssignable<{stdout: string}>(await execaCommand({})('unicorns'));
61 unmodified lines
modified:test-d/methods/main-async.test-d.ts+10 added-10 removed
1import {expectType, expectError, expectAssignable} from 'tsd';2import {execa, type ExecaResult, type ExecaSubprocess} from '../../index.js';2import {execa, type ExecaResult, type ExecaResultPromise} from '../../index.js';34const fileUrl = new URL('file:///test');5const stringArray = ['foo', 'bar'] as const;67expectError(execa());8expectError(execa(true));9expectError(execa(['unicorns', 'arg']));10expectAssignable<ExecaSubprocess>(execa('unicorns'));11expectAssignable<ExecaSubprocess>(execa(fileUrl));10expectAssignable<ExecaResultPromise>(execa('unicorns'));11expectAssignable<ExecaResultPromise>(execa(fileUrl));1213expectAssignable<ExecaSubprocess>(execa('unicorns', []));14expectAssignable<ExecaSubprocess>(execa('unicorns', ['foo']));13expectAssignable<ExecaResultPromise>(execa('unicorns', []));14expectAssignable<ExecaResultPromise>(execa('unicorns', ['foo']));15expectError(execa('unicorns', 'foo'));16expectError(execa('unicorns', [true]));1718expectAssignable<ExecaSubprocess>(execa('unicorns', {}));19expectAssignable<ExecaSubprocess>(execa('unicorns', [], {}));18expectAssignable<ExecaResultPromise>(execa('unicorns', {}));19expectAssignable<ExecaResultPromise>(execa('unicorns', [], {}));20expectError(execa('unicorns', [], []));21expectError(execa('unicorns', {other: true}));2223expectAssignable<ExecaSubprocess>(execa`unicorns`);23expectAssignable<ExecaResultPromise>(execa`unicorns`);24expectType<ExecaResult<{}>>(await execa('unicorns'));25expectType<ExecaResult<{}>>(await execa`unicorns`);2627expectAssignable<typeof execa>(execa({}));28expectAssignable<ExecaSubprocess>(execa({})('unicorns'));29expectAssignable<ExecaSubprocess>(execa({})`unicorns`);28expectAssignable<ExecaResultPromise>(execa({})('unicorns'));29expectAssignable<ExecaResultPromise>(execa({})`unicorns`);3031expectAssignable<{stdout: string}>(await execa('unicorns'));32expectAssignable<{stdout: Uint8Array}>(await execa('unicorns', {encoding: 'buffer'}));33expectAssignable<{stdout: string}>(await execa('unicorns', ['foo']));
23 unmodified lines
modified:test-d/methods/node.test-d.ts+12 added-12 removed
1import {expectType, expectError, expectAssignable} from 'tsd';2import {execaNode, type ExecaResult, type ExecaSubprocess} from '../../index.js';2import {execaNode, type ExecaResult, type ExecaResultPromise} from '../../index.js';34const fileUrl = new URL('file:///test');5const stringArray = ['foo', 'bar'] as const;67expectError(execaNode());8expectError(execaNode(true));9expectError(execaNode(['unicorns', 'arg']));10expectAssignable<ExecaSubprocess>(execaNode('unicorns'));11expectAssignable<ExecaSubprocess>(execaNode(fileUrl));10expectAssignable<ExecaResultPromise>(execaNode('unicorns'));11expectAssignable<ExecaResultPromise>(execaNode(fileUrl));1213expectAssignable<ExecaSubprocess>(execaNode('unicorns', []));14expectAssignable<ExecaSubprocess>(execaNode('unicorns', ['foo']));13expectAssignable<ExecaResultPromise>(execaNode('unicorns', []));14expectAssignable<ExecaResultPromise>(execaNode('unicorns', ['foo']));15expectError(execaNode('unicorns', 'foo'));16expectError(execaNode('unicorns', [true]));1718expectAssignable<ExecaSubprocess>(execaNode('unicorns', {}));19expectAssignable<ExecaSubprocess>(execaNode('unicorns', [], {}));18expectAssignable<ExecaResultPromise>(execaNode('unicorns', {}));19expectAssignable<ExecaResultPromise>(execaNode('unicorns', [], {}));20expectError(execaNode('unicorns', [], []));21expectError(execaNode('unicorns', {other: true}));2223expectAssignable<ExecaSubprocess>(execaNode`unicorns`);23expectAssignable<ExecaResultPromise>(execaNode`unicorns`);24expectType<ExecaResult<{}>>(await execaNode('unicorns'));25expectType<ExecaResult<{}>>(await execaNode`unicorns`);2627expectAssignable<typeof execaNode>(execaNode({}));28expectAssignable<ExecaSubprocess>(execaNode({})('unicorns'));29expectAssignable<ExecaSubprocess>(execaNode({})`unicorns`);28expectAssignable<ExecaResultPromise>(execaNode({})('unicorns'));29expectAssignable<ExecaResultPromise>(execaNode({})`unicorns`);3031expectAssignable<{stdout: string}>(await execaNode('unicorns'));32expectAssignable<{stdout: Uint8Array}>(await execaNode('unicorns', {encoding: 'buffer'}));33expectAssignable<{stdout: string}>(await execaNode('unicorns', ['foo']));
20 unmodified lines
54expectError(await execaNode`unicorns ${execaNode`echo foo`}`);55expectType<ExecaResult<{}>>(await execaNode`unicorns ${[await execaNode`echo foo`, 'bar']}`);56expectError(await execaNode`unicorns ${[execaNode`echo foo`, 'bar']}`);5758expectAssignable<ExecaSubprocess>(execaNode('unicorns', {nodePath: './node'}));59expectAssignable<ExecaSubprocess>(execaNode('unicorns', {nodePath: fileUrl}));58expectAssignable<ExecaResultPromise>(execaNode('unicorns', {nodePath: './node'}));59expectAssignable<ExecaResultPromise>(execaNode('unicorns', {nodePath: fileUrl}));60expectAssignable<{stdout: string}>(await execaNode('unicorns', {nodeOptions: ['--async-stack-traces']}));61expectAssignable<{stdout: Uint8Array}>(await execaNode('unicorns', {nodeOptions: ['--async-stack-traces'], encoding: 'buffer'}));62expectAssignable<{stdout: string}>(await execaNode('unicorns', ['foo'], {nodeOptions: ['--async-stack-traces']}));63expectAssignable<{stdout: Uint8Array}>(await execaNode('unicorns', ['foo'], {nodeOptions: ['--async-stack-traces'], encoding: 'buffer'}));
modified:test-d/methods/script.test-d.ts+10 added-10 removed
1import {expectType, expectError, expectAssignable} from 'tsd';2import {$, type ExecaResult, type ExecaSubprocess} from '../../index.js';2import {$, type ExecaResult, type ExecaResultPromise} from '../../index.js';34const fileUrl = new URL('file:///test');5const stringArray = ['foo', 'bar'] as const;67expectError($());8expectError($(true));9expectError($(['unicorns', 'arg']));10expectAssignable<ExecaSubprocess>($('unicorns'));11expectAssignable<ExecaSubprocess>($(fileUrl));10expectAssignable<ExecaResultPromise>($('unicorns'));11expectAssignable<ExecaResultPromise>($(fileUrl));1213expectAssignable<ExecaSubprocess>($('unicorns', []));14expectAssignable<ExecaSubprocess>($('unicorns', ['foo']));13expectAssignable<ExecaResultPromise>($('unicorns', []));14expectAssignable<ExecaResultPromise>($('unicorns', ['foo']));15expectError($('unicorns', 'foo'));16expectError($('unicorns', [true]));1718expectAssignable<ExecaSubprocess>($('unicorns', {}));19expectAssignable<ExecaSubprocess>($('unicorns', [], {}));18expectAssignable<ExecaResultPromise>($('unicorns', {}));19expectAssignable<ExecaResultPromise>($('unicorns', [], {}));20expectError($('unicorns', [], []));21expectError($('unicorns', {other: true}));2223expectAssignable<ExecaSubprocess>($`unicorns`);23expectAssignable<ExecaResultPromise>($`unicorns`);24expectType<ExecaResult<{}>>(await $('unicorns'));25expectType<ExecaResult<{}>>(await $`unicorns`);2627expectAssignable<typeof $>($({}));28expectAssignable<ExecaSubprocess>($({})('unicorns'));29expectAssignable<ExecaSubprocess>($({})`unicorns`);28expectAssignable<ExecaResultPromise>($({})('unicorns'));29expectAssignable<ExecaResultPromise>($({})`unicorns`);3031expectAssignable<{stdout: string}>(await $('unicorns'));32expectAssignable<{stdout: Uint8Array}>(await $('unicorns', {encoding: 'buffer'}));33expectAssignable<{stdout: string}>(await $('unicorns', ['foo']));
23 unmodified lines
modified:test-d/return/ignore-option.test-d.ts+64 added-64 removed
5 unmodified lines
6 type ExecaError,7 type ExecaSyncError,8} from '../../index.js';910const ignoreAnyPromise = execa('unicorns', {10const ignoreAnySubprocess = execa('unicorns', {11 stdin: 'ignore',12 stdout: 'ignore',13 stderr: 'ignore',14 all: true,15});16expectType<null>(ignoreAnyPromise.stdin);17expectType<null>(ignoreAnyPromise.stdio[0]);18expectType<null>(ignoreAnyPromise.stdout);19expectType<null>(ignoreAnyPromise.stdio[1]);20expectType<null>(ignoreAnyPromise.stderr);21expectType<null>(ignoreAnyPromise.stdio[2]);22expectType<undefined>(ignoreAnyPromise.all);23expectError(ignoreAnyPromise.stdio[3].destroy());16expectType<null>(ignoreAnySubprocess.stdin);17expectType<null>(ignoreAnySubprocess.stdio[0]);18expectType<null>(ignoreAnySubprocess.stdout);19expectType<null>(ignoreAnySubprocess.stdio[1]);20expectType<null>(ignoreAnySubprocess.stderr);21expectType<null>(ignoreAnySubprocess.stdio[2]);22expectType<undefined>(ignoreAnySubprocess.all);23expectError(ignoreAnySubprocess.stdio[3].destroy());2425const ignoreAnyResult = await ignoreAnyPromise;25const ignoreAnyResult = await ignoreAnySubprocess;26expectType<undefined>(ignoreAnyResult.stdout);27expectType<undefined>(ignoreAnyResult.stdio[1]);28expectType<undefined>(ignoreAnyResult.stderr);29expectType<undefined>(ignoreAnyResult.stdio[2]);30expectType<undefined>(ignoreAnyResult.all);3132const ignoreAllPromise = execa('unicorns', {stdio: 'ignore', all: true});33expectType<null>(ignoreAllPromise.stdin);34expectType<null>(ignoreAllPromise.stdio[0]);35expectType<null>(ignoreAllPromise.stdout);36expectType<null>(ignoreAllPromise.stdio[1]);37expectType<null>(ignoreAllPromise.stderr);38expectType<null>(ignoreAllPromise.stdio[2]);39expectType<undefined>(ignoreAllPromise.all);40expectError(ignoreAllPromise.stdio[3].destroy());32const ignoreAllSubprocess = execa('unicorns', {stdio: 'ignore', all: true});33expectType<null>(ignoreAllSubprocess.stdin);34expectType<null>(ignoreAllSubprocess.stdio[0]);35expectType<null>(ignoreAllSubprocess.stdout);36expectType<null>(ignoreAllSubprocess.stdio[1]);37expectType<null>(ignoreAllSubprocess.stderr);38expectType<null>(ignoreAllSubprocess.stdio[2]);39expectType<undefined>(ignoreAllSubprocess.all);40expectError(ignoreAllSubprocess.stdio[3].destroy());4142const ignoreAllResult = await ignoreAllPromise;42const ignoreAllResult = await ignoreAllSubprocess;43expectType<undefined>(ignoreAllResult.stdout);44expectType<undefined>(ignoreAllResult.stdio[1]);45expectType<undefined>(ignoreAllResult.stderr);46expectType<undefined>(ignoreAllResult.stdio[2]);47expectType<undefined>(ignoreAllResult.all);4849const ignoreStdioArrayPromise = execa('unicorns', {stdio: ['ignore', 'ignore', 'pipe', 'pipe'], all: true});50expectType<null>(ignoreStdioArrayPromise.stdin);51expectType<null>(ignoreStdioArrayPromise.stdio[0]);52expectType<null>(ignoreStdioArrayPromise.stdout);53expectType<null>(ignoreStdioArrayPromise.stdio[1]);54expectType<Readable>(ignoreStdioArrayPromise.stderr);55expectType<Readable>(ignoreStdioArrayPromise.stdio[2]);56expectType<Readable>(ignoreStdioArrayPromise.all);57expectType<Readable>(ignoreStdioArrayPromise.stdio[3]);58const ignoreStdioArrayResult = await ignoreStdioArrayPromise;49const ignoreStdioArraySubprocess = execa('unicorns', {stdio: ['ignore', 'ignore', 'pipe', 'pipe'], all: true});50expectType<null>(ignoreStdioArraySubprocess.stdin);51expectType<null>(ignoreStdioArraySubprocess.stdio[0]);52expectType<null>(ignoreStdioArraySubprocess.stdout);53expectType<null>(ignoreStdioArraySubprocess.stdio[1]);54expectType<Readable>(ignoreStdioArraySubprocess.stderr);55expectType<Readable>(ignoreStdioArraySubprocess.stdio[2]);56expectType<Readable>(ignoreStdioArraySubprocess.all);57expectType<Readable>(ignoreStdioArraySubprocess.stdio[3]);58const ignoreStdioArrayResult = await ignoreStdioArraySubprocess;59expectType<undefined>(ignoreStdioArrayResult.stdout);60expectType<undefined>(ignoreStdioArrayResult.stdio[1]);61expectType<string>(ignoreStdioArrayResult.stderr);62expectType<string>(ignoreStdioArrayResult.stdio[2]);63expectType<string>(ignoreStdioArrayResult.all);6465const ignoreStdioArrayReadPromise = execa('unicorns', {stdio: ['ignore', 'ignore', 'pipe', new Uint8Array()], all: true});66expectType<Writable>(ignoreStdioArrayReadPromise.stdio[3]);65const ignoreStdioArrayReadSubprocess = execa('unicorns', {stdio: ['ignore', 'ignore', 'pipe', new Uint8Array()], all: true});66expectType<Writable>(ignoreStdioArrayReadSubprocess.stdio[3]);6768const ignoreStdinPromise = execa('unicorns', {stdin: 'ignore'});69expectType<null>(ignoreStdinPromise.stdin);68const ignoreStdinSubprocess = execa('unicorns', {stdin: 'ignore'});69expectType<null>(ignoreStdinSubprocess.stdin);7071const ignoreStdoutPromise = execa('unicorns', {stdout: 'ignore', all: true});72expectType<Writable>(ignoreStdoutPromise.stdin);73expectType<Writable>(ignoreStdoutPromise.stdio[0]);74expectType<null>(ignoreStdoutPromise.stdout);75expectType<null>(ignoreStdoutPromise.stdio[1]);76expectType<Readable>(ignoreStdoutPromise.stderr);77expectType<Readable>(ignoreStdoutPromise.stdio[2]);78expectType<Readable>(ignoreStdoutPromise.all);79expectError(ignoreStdoutPromise.stdio[3].destroy());71const ignoreStdoutSubprocess = execa('unicorns', {stdout: 'ignore', all: true});72expectType<Writable>(ignoreStdoutSubprocess.stdin);73expectType<Writable>(ignoreStdoutSubprocess.stdio[0]);74expectType<null>(ignoreStdoutSubprocess.stdout);75expectType<null>(ignoreStdoutSubprocess.stdio[1]);76expectType<Readable>(ignoreStdoutSubprocess.stderr);77expectType<Readable>(ignoreStdoutSubprocess.stdio[2]);78expectType<Readable>(ignoreStdoutSubprocess.all);79expectError(ignoreStdoutSubprocess.stdio[3].destroy());8081const ignoreStdoutResult = await ignoreStdoutPromise;81const ignoreStdoutResult = await ignoreStdoutSubprocess;82expectType<undefined>(ignoreStdoutResult.stdout);83expectType<string>(ignoreStdoutResult.stderr);84expectType<string>(ignoreStdoutResult.all);8586const ignoreStderrPromise = execa('unicorns', {stderr: 'ignore', all: true});87expectType<Writable>(ignoreStderrPromise.stdin);88expectType<Writable>(ignoreStderrPromise.stdio[0]);89expectType<Readable>(ignoreStderrPromise.stdout);90expectType<Readable>(ignoreStderrPromise.stdio[1]);91expectType<null>(ignoreStderrPromise.stderr);92expectType<null>(ignoreStderrPromise.stdio[2]);93expectType<Readable>(ignoreStderrPromise.all);94expectError(ignoreStderrPromise.stdio[3].destroy());86const ignoreStderrSubprocess = execa('unicorns', {stderr: 'ignore', all: true});87expectType<Writable>(ignoreStderrSubprocess.stdin);88expectType<Writable>(ignoreStderrSubprocess.stdio[0]);89expectType<Readable>(ignoreStderrSubprocess.stdout);90expectType<Readable>(ignoreStderrSubprocess.stdio[1]);91expectType<null>(ignoreStderrSubprocess.stderr);92expectType<null>(ignoreStderrSubprocess.stdio[2]);93expectType<Readable>(ignoreStderrSubprocess.all);94expectError(ignoreStderrSubprocess.stdio[3].destroy());9596const ignoreStderrResult = await ignoreStderrPromise;96const ignoreStderrResult = await ignoreStderrSubprocess;97expectType<string>(ignoreStderrResult.stdout);98expectType<undefined>(ignoreStderrResult.stderr);99expectType<string>(ignoreStderrResult.all);100101const ignoreStdioPromise = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', 'ignore'], all: true});102expectType<Writable>(ignoreStdioPromise.stdin);103expectType<Writable>(ignoreStdioPromise.stdio[0]);104expectType<Readable>(ignoreStdioPromise.stdout);105expectType<Readable>(ignoreStdioPromise.stdio[1]);106expectType<Readable>(ignoreStdioPromise.stderr);107expectType<Readable>(ignoreStdioPromise.stdio[2]);108expectType<Readable>(ignoreStdioPromise.all);109expectType<null>(ignoreStdioPromise.stdio[3]);101const ignoreStdioSubprocess = execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', 'ignore'], all: true});102expectType<Writable>(ignoreStdioSubprocess.stdin);103expectType<Writable>(ignoreStdioSubprocess.stdio[0]);104expectType<Readable>(ignoreStdioSubprocess.stdout);105expectType<Readable>(ignoreStdioSubprocess.stdio[1]);106expectType<Readable>(ignoreStdioSubprocess.stderr);107expectType<Readable>(ignoreStdioSubprocess.stdio[2]);108expectType<Readable>(ignoreStdioSubprocess.all);109expectType<null>(ignoreStdioSubprocess.stdio[3]);110111const ignoreStdioResult = await ignoreStdioPromise;111const ignoreStdioResult = await ignoreStdioSubprocess;112expectType<string>(ignoreStdioResult.stdout);113expectType<string>(ignoreStdioResult.stderr);114expectType<string>(ignoreStdioResult.all);115
38 unmodified lines
modified:test-d/return/no-buffer-main.test-d.ts+10 added-10 removed
5 unmodified lines
6 type ExecaError,7 type ExecaSyncError,8} from '../../index.js';910const noBufferPromise = execa('unicorns', {buffer: false, all: true});11expectType<Writable>(noBufferPromise.stdin);12expectType<Writable>(noBufferPromise.stdio[0]);13expectType<Readable>(noBufferPromise.stdout);14expectType<Readable>(noBufferPromise.stdio[1]);15expectType<Readable>(noBufferPromise.stderr);16expectType<Readable>(noBufferPromise.stdio[2]);17expectType<Readable>(noBufferPromise.all);18expectError(noBufferPromise.stdio[3].destroy());10const noBufferSubprocess = execa('unicorns', {buffer: false, all: true});11expectType<Writable>(noBufferSubprocess.stdin);12expectType<Writable>(noBufferSubprocess.stdio[0]);13expectType<Readable>(noBufferSubprocess.stdout);14expectType<Readable>(noBufferSubprocess.stdio[1]);15expectType<Readable>(noBufferSubprocess.stderr);16expectType<Readable>(noBufferSubprocess.stdio[2]);17expectType<Readable>(noBufferSubprocess.all);18expectError(noBufferSubprocess.stdio[3].destroy());1920const noBufferResult = await noBufferPromise;20const noBufferResult = await noBufferSubprocess;21expectType<undefined>(noBufferResult.stdout);22expectType<undefined>(noBufferResult.stdio[1]);23expectType<undefined>(noBufferResult.stderr);24expectType<undefined>(noBufferResult.stdio[2]);
21 unmodified lines
modified:test-d/subprocess/all.test-d.ts+4 added-4 removed
1import type {Readable} from 'node:stream';2import {expectType} from 'tsd';3import {execa} from '../../index.js';45const allPromise = execa('unicorns', {all: true});6expectType<Readable>(allPromise.all);5const allSubprocess = execa('unicorns', {all: true});6expectType<Readable>(allSubprocess.all);78const noAllPromise = execa('unicorns');9expectType<undefined>(noAllPromise.all);8const noAllSubprocess = execa('unicorns');9expectType<undefined>(noAllSubprocess.all);
modified:test-d/subprocess/stdio.test-d.ts+29 added-29 removed
5 unmodified lines
6expectType<Readable | null>({} as ExecaSubprocess['stdout']);7expectType<Readable | null>({} as ExecaSubprocess['stderr']);8expectType<Readable | undefined>({} as ExecaSubprocess['all']);910const execaBufferPromise = execa('unicorns', {encoding: 'buffer', all: true});11expectType<Writable>(execaBufferPromise.stdin);12expectType<Writable>(execaBufferPromise.stdio[0]);13expectType<Readable>(execaBufferPromise.stdout);14expectType<Readable>(execaBufferPromise.stdio[1]);15expectType<Readable>(execaBufferPromise.stderr);16expectType<Readable>(execaBufferPromise.stdio[2]);17expectType<Readable>(execaBufferPromise.all);18expectError(execaBufferPromise.stdio[3].destroy());10const bufferSubprocess = execa('unicorns', {encoding: 'buffer', all: true});11expectType<Writable>(bufferSubprocess.stdin);12expectType<Writable>(bufferSubprocess.stdio[0]);13expectType<Readable>(bufferSubprocess.stdout);14expectType<Readable>(bufferSubprocess.stdio[1]);15expectType<Readable>(bufferSubprocess.stderr);16expectType<Readable>(bufferSubprocess.stdio[2]);17expectType<Readable>(bufferSubprocess.all);18expectError(bufferSubprocess.stdio[3].destroy());1920const execaHexPromise = execa('unicorns', {encoding: 'hex', all: true});21expectType<Writable>(execaHexPromise.stdin);22expectType<Writable>(execaHexPromise.stdio[0]);23expectType<Readable>(execaHexPromise.stdout);24expectType<Readable>(execaHexPromise.stdio[1]);25expectType<Readable>(execaHexPromise.stderr);26expectType<Readable>(execaHexPromise.stdio[2]);27expectType<Readable>(execaHexPromise.all);28expectError(execaHexPromise.stdio[3].destroy());20const hexSubprocess = execa('unicorns', {encoding: 'hex', all: true});21expectType<Writable>(hexSubprocess.stdin);22expectType<Writable>(hexSubprocess.stdio[0]);23expectType<Readable>(hexSubprocess.stdout);24expectType<Readable>(hexSubprocess.stdio[1]);25expectType<Readable>(hexSubprocess.stderr);26expectType<Readable>(hexSubprocess.stdio[2]);27expectType<Readable>(hexSubprocess.all);28expectError(hexSubprocess.stdio[3].destroy());2930const multipleStdinPromise = execa('unicorns', {stdin: ['inherit', 'pipe']});31expectType<Writable>(multipleStdinPromise.stdin);30const multipleStdinSubprocess = execa('unicorns', {stdin: ['inherit', 'pipe']});31expectType<Writable>(multipleStdinSubprocess.stdin);3233const multipleStdoutPromise = execa('unicorns', {stdout: ['inherit', 'pipe'] as ['inherit', 'pipe'], all: true});34expectType<Writable>(multipleStdoutPromise.stdin);35expectType<Writable>(multipleStdoutPromise.stdio[0]);36expectType<Readable>(multipleStdoutPromise.stdout);37expectType<Readable>(multipleStdoutPromise.stdio[1]);38expectType<Readable>(multipleStdoutPromise.stderr);39expectType<Readable>(multipleStdoutPromise.stdio[2]);40expectType<Readable>(multipleStdoutPromise.all);41expectError(multipleStdoutPromise.stdio[3].destroy());33const multipleStdoutSubprocess = execa('unicorns', {stdout: ['inherit', 'pipe'] as ['inherit', 'pipe'], all: true});34expectType<Writable>(multipleStdoutSubprocess.stdin);35expectType<Writable>(multipleStdoutSubprocess.stdio[0]);36expectType<Readable>(multipleStdoutSubprocess.stdout);37expectType<Readable>(multipleStdoutSubprocess.stdio[1]);38expectType<Readable>(multipleStdoutSubprocess.stderr);39expectType<Readable>(multipleStdoutSubprocess.stdio[2]);40expectType<Readable>(multipleStdoutSubprocess.all);41expectError(multipleStdoutSubprocess.stdio[3].destroy());
modified:test-d/subprocess/subprocess.test-d.ts+25 added-21 removed
1import {expectType, expectError} from 'tsd';2import {execa} from '../../index.js';1import {expectType, expectError, expectAssignable} from 'tsd';2import {execa, type ExecaSubprocess} from '../../index.js';34const execaPromise = execa('unicorns');4const subprocess = execa('unicorns');5expectAssignable<ExecaSubprocess>(subprocess);66expectType<number | undefined>(execaPromise.pid);7expectType<number | undefined>(subprocess.pid);88expectType<boolean>(execa('unicorns').kill());9execa('unicorns').kill('SIGKILL');10execa('unicorns').kill(undefined);11execa('unicorns').kill(new Error('test'));12execa('unicorns').kill('SIGKILL', new Error('test'));13execa('unicorns').kill(undefined, new Error('test'));14expectError(execa('unicorns').kill(null));15expectError(execa('unicorns').kill(0n));16expectError(execa('unicorns').kill([new Error('test')]));17expectError(execa('unicorns').kill({message: 'test'}));18expectError(execa('unicorns').kill(undefined, {}));19expectError(execa('unicorns').kill('SIGKILL', {}));20expectError(execa('unicorns').kill(null, new Error('test')));9expectType<boolean>(subprocess.kill());10subprocess.kill('SIGKILL');11subprocess.kill(undefined);12subprocess.kill(new Error('test'));13subprocess.kill('SIGKILL', new Error('test'));14subprocess.kill(undefined, new Error('test'));15expectError(subprocess.kill(null));16expectError(subprocess.kill(0n));17expectError(subprocess.kill([new Error('test')]));18expectError(subprocess.kill({message: 'test'}));19expectError(subprocess.kill(undefined, {}));20expectError(subprocess.kill('SIGKILL', {}));21expectError(subprocess.kill(null, new Error('test')));2222expectType<boolean>(execa('unicorns', {ipc: true}).send({}));23const ipcSubprocess = execa('unicorns', {ipc: true});24expectAssignable<ExecaSubprocess>(subprocess);2526expectType<boolean>(ipcSubprocess.send({}));27execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', 'ipc']}).send({});28execa('unicorns', {stdio: ['pipe', 'pipe', 'ipc', 'pipe']}).send({});25execa('unicorns', {ipc: true}).send('message');26execa('unicorns', {ipc: true}).send({}, undefined, {keepOpen: true});27expectError(execa('unicorns', {ipc: true}).send({}, true));29ipcSubprocess.send('message');30ipcSubprocess.send({}, undefined, {keepOpen: true});31expectError(ipcSubprocess.send({}, true));32expectType<undefined>(execa('unicorns', {}).send);33expectType<undefined>(execa('unicorns', {ipc: false}).send);34expectType<undefined>(execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', 'pipe']}).send);
modified:test-d/pipe.test-d.ts+194 added-194 removed
9 unmodified lines
10const fileUrl = new URL('file:///test');11const stringArray = ['foo', 'bar'] as const;12const pipeOptions = {from: 'stderr', to: 'fd3', all: true} as const;1314const execaPromise = execa('unicorns', {all: true});15const execaBufferPromise = execa('unicorns', {encoding: 'buffer', all: true});16const scriptPromise = $`unicorns`;14const subprocess = execa('unicorns', {all: true});15const bufferSubprocess = execa('unicorns', {encoding: 'buffer', all: true});16const scriptSubprocess = $`unicorns`;1718const bufferResult = await execaBufferPromise;18const bufferResult = await bufferSubprocess;19type BufferExecaReturnValue = typeof bufferResult;20type EmptyExecaReturnValue = ExecaResult<{}>;21type ShortcutExecaReturnValue = ExecaResult<typeof pipeOptions>;2223expectNotType<BufferExecaReturnValue>(await execaPromise.pipe(execaPromise));24expectNotType<BufferExecaReturnValue>(await scriptPromise.pipe(execaPromise));25expectType<BufferExecaReturnValue>(await execaPromise.pipe(execaBufferPromise));26expectType<BufferExecaReturnValue>(await scriptPromise.pipe(execaBufferPromise));27expectType<BufferExecaReturnValue>(await execaPromise.pipe(execaBufferPromise, pipeOptions));28expectType<BufferExecaReturnValue>(await scriptPromise.pipe(execaBufferPromise, pipeOptions));23expectNotType<BufferExecaReturnValue>(await subprocess.pipe(subprocess));24expectNotType<BufferExecaReturnValue>(await scriptSubprocess.pipe(subprocess));25expectType<BufferExecaReturnValue>(await subprocess.pipe(bufferSubprocess));26expectType<BufferExecaReturnValue>(await scriptSubprocess.pipe(bufferSubprocess));27expectType<BufferExecaReturnValue>(await subprocess.pipe(bufferSubprocess, pipeOptions));28expectType<BufferExecaReturnValue>(await scriptSubprocess.pipe(bufferSubprocess, pipeOptions));2930expectType<EmptyExecaReturnValue>(await execaPromise.pipe`stdin`);31expectType<EmptyExecaReturnValue>(await scriptPromise.pipe`stdin`);32expectType<ShortcutExecaReturnValue>(await execaPromise.pipe(pipeOptions)`stdin`);33expectType<ShortcutExecaReturnValue>(await scriptPromise.pipe(pipeOptions)`stdin`);30expectType<EmptyExecaReturnValue>(await subprocess.pipe`stdin`);31expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe`stdin`);32expectType<ShortcutExecaReturnValue>(await subprocess.pipe(pipeOptions)`stdin`);33expectType<ShortcutExecaReturnValue>(await scriptSubprocess.pipe(pipeOptions)`stdin`);3435expectType<EmptyExecaReturnValue>(await execaPromise.pipe('stdin'));36expectType<EmptyExecaReturnValue>(await scriptPromise.pipe('stdin'));37expectType<ShortcutExecaReturnValue>(await execaPromise.pipe('stdin', pipeOptions));38expectType<ShortcutExecaReturnValue>(await scriptPromise.pipe('stdin', pipeOptions));35expectType<EmptyExecaReturnValue>(await subprocess.pipe('stdin'));36expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe('stdin'));37expectType<ShortcutExecaReturnValue>(await subprocess.pipe('stdin', pipeOptions));38expectType<ShortcutExecaReturnValue>(await scriptSubprocess.pipe('stdin', pipeOptions));3940expectType<BufferExecaReturnValue>(await execaPromise.pipe(execaPromise).pipe(execaBufferPromise));41expectType<BufferExecaReturnValue>(await scriptPromise.pipe(execaPromise).pipe(execaBufferPromise));42expectType<BufferExecaReturnValue>(await execaPromise.pipe(execaPromise, pipeOptions).pipe(execaBufferPromise));43expectType<BufferExecaReturnValue>(await scriptPromise.pipe(execaPromise, pipeOptions).pipe(execaBufferPromise));44expectType<BufferExecaReturnValue>(await execaPromise.pipe(execaPromise).pipe(execaBufferPromise, pipeOptions));45expectType<BufferExecaReturnValue>(await scriptPromise.pipe(execaPromise).pipe(execaBufferPromise, pipeOptions));40expectType<BufferExecaReturnValue>(await subprocess.pipe(subprocess).pipe(bufferSubprocess));41expectType<BufferExecaReturnValue>(await scriptSubprocess.pipe(subprocess).pipe(bufferSubprocess));42expectType<BufferExecaReturnValue>(await subprocess.pipe(subprocess, pipeOptions).pipe(bufferSubprocess));43expectType<BufferExecaReturnValue>(await scriptSubprocess.pipe(subprocess, pipeOptions).pipe(bufferSubprocess));44expectType<BufferExecaReturnValue>(await subprocess.pipe(subprocess).pipe(bufferSubprocess, pipeOptions));45expectType<BufferExecaReturnValue>(await scriptSubprocess.pipe(subprocess).pipe(bufferSubprocess, pipeOptions));4647expectType<EmptyExecaReturnValue>(await execaPromise.pipe(execaPromise).pipe`stdin`);48expectType<EmptyExecaReturnValue>(await scriptPromise.pipe(execaPromise).pipe`stdin`);49expectType<EmptyExecaReturnValue>(await execaPromise.pipe(execaPromise, pipeOptions).pipe`stdin`);50expectType<EmptyExecaReturnValue>(await scriptPromise.pipe(execaPromise, pipeOptions).pipe`stdin`);51expectType<ShortcutExecaReturnValue>(await execaPromise.pipe(execaPromise).pipe(pipeOptions)`stdin`);52expectType<ShortcutExecaReturnValue>(await scriptPromise.pipe(execaPromise).pipe(pipeOptions)`stdin`);47expectType<EmptyExecaReturnValue>(await subprocess.pipe(subprocess).pipe`stdin`);48expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe(subprocess).pipe`stdin`);49expectType<EmptyExecaReturnValue>(await subprocess.pipe(subprocess, pipeOptions).pipe`stdin`);50expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe(subprocess, pipeOptions).pipe`stdin`);51expectType<ShortcutExecaReturnValue>(await subprocess.pipe(subprocess).pipe(pipeOptions)`stdin`);52expectType<ShortcutExecaReturnValue>(await scriptSubprocess.pipe(subprocess).pipe(pipeOptions)`stdin`);5354expectType<EmptyExecaReturnValue>(await execaPromise.pipe(execaPromise).pipe('stdin'));55expectType<EmptyExecaReturnValue>(await scriptPromise.pipe(execaPromise).pipe('stdin'));56expectType<EmptyExecaReturnValue>(await execaPromise.pipe(execaPromise, pipeOptions).pipe('stdin'));57expectType<EmptyExecaReturnValue>(await scriptPromise.pipe(execaPromise, pipeOptions).pipe('stdin'));58expectType<ShortcutExecaReturnValue>(await execaPromise.pipe(execaPromise).pipe('stdin', pipeOptions));59expectType<ShortcutExecaReturnValue>(await scriptPromise.pipe(execaPromise).pipe('stdin', pipeOptions));54expectType<EmptyExecaReturnValue>(await subprocess.pipe(subprocess).pipe('stdin'));55expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe(subprocess).pipe('stdin'));56expectType<EmptyExecaReturnValue>(await subprocess.pipe(subprocess, pipeOptions).pipe('stdin'));57expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe(subprocess, pipeOptions).pipe('stdin'));58expectType<ShortcutExecaReturnValue>(await subprocess.pipe(subprocess).pipe('stdin', pipeOptions));59expectType<ShortcutExecaReturnValue>(await scriptSubprocess.pipe(subprocess).pipe('stdin', pipeOptions));6061expectType<BufferExecaReturnValue>(await execaPromise.pipe`stdin`.pipe(execaBufferPromise));62expectType<BufferExecaReturnValue>(await scriptPromise.pipe`stdin`.pipe(execaBufferPromise));63expectType<BufferExecaReturnValue>(await execaPromise.pipe(pipeOptions)`stdin`.pipe(execaBufferPromise));64expectType<BufferExecaReturnValue>(await scriptPromise.pipe(pipeOptions)`stdin`.pipe(execaBufferPromise));65expectType<BufferExecaReturnValue>(await execaPromise.pipe`stdin`.pipe(execaBufferPromise, pipeOptions));66expectType<BufferExecaReturnValue>(await scriptPromise.pipe`stdin`.pipe(execaBufferPromise, pipeOptions));61expectType<BufferExecaReturnValue>(await subprocess.pipe`stdin`.pipe(bufferSubprocess));62expectType<BufferExecaReturnValue>(await scriptSubprocess.pipe`stdin`.pipe(bufferSubprocess));63expectType<BufferExecaReturnValue>(await subprocess.pipe(pipeOptions)`stdin`.pipe(bufferSubprocess));64expectType<BufferExecaReturnValue>(await scriptSubprocess.pipe(pipeOptions)`stdin`.pipe(bufferSubprocess));65expectType<BufferExecaReturnValue>(await subprocess.pipe`stdin`.pipe(bufferSubprocess, pipeOptions));66expectType<BufferExecaReturnValue>(await scriptSubprocess.pipe`stdin`.pipe(bufferSubprocess, pipeOptions));6768expectType<EmptyExecaReturnValue>(await execaPromise.pipe`stdin`.pipe`stdin`);69expectType<EmptyExecaReturnValue>(await scriptPromise.pipe`stdin`.pipe`stdin`);70expectType<EmptyExecaReturnValue>(await execaPromise.pipe(pipeOptions)`stdin`.pipe`stdin`);71expectType<EmptyExecaReturnValue>(await scriptPromise.pipe(pipeOptions)`stdin`.pipe`stdin`);72expectType<ShortcutExecaReturnValue>(await execaPromise.pipe`stdin`.pipe(pipeOptions)`stdin`);73expectType<ShortcutExecaReturnValue>(await scriptPromise.pipe`stdin`.pipe(pipeOptions)`stdin`);68expectType<EmptyExecaReturnValue>(await subprocess.pipe`stdin`.pipe`stdin`);69expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe`stdin`.pipe`stdin`);70expectType<EmptyExecaReturnValue>(await subprocess.pipe(pipeOptions)`stdin`.pipe`stdin`);71expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe(pipeOptions)`stdin`.pipe`stdin`);72expectType<ShortcutExecaReturnValue>(await subprocess.pipe`stdin`.pipe(pipeOptions)`stdin`);73expectType<ShortcutExecaReturnValue>(await scriptSubprocess.pipe`stdin`.pipe(pipeOptions)`stdin`);7475expectType<EmptyExecaReturnValue>(await execaPromise.pipe`stdin`.pipe('stdin'));76expectType<EmptyExecaReturnValue>(await scriptPromise.pipe`stdin`.pipe('stdin'));77expectType<EmptyExecaReturnValue>(await execaPromise.pipe(pipeOptions)`stdin`.pipe('stdin'));78expectType<EmptyExecaReturnValue>(await scriptPromise.pipe(pipeOptions)`stdin`.pipe('stdin'));79expectType<ShortcutExecaReturnValue>(await execaPromise.pipe`stdin`.pipe('stdin', pipeOptions));80expectType<ShortcutExecaReturnValue>(await scriptPromise.pipe`stdin`.pipe('stdin', pipeOptions));75expectType<EmptyExecaReturnValue>(await subprocess.pipe`stdin`.pipe('stdin'));76expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe`stdin`.pipe('stdin'));77expectType<EmptyExecaReturnValue>(await subprocess.pipe(pipeOptions)`stdin`.pipe('stdin'));78expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe(pipeOptions)`stdin`.pipe('stdin'));79expectType<ShortcutExecaReturnValue>(await subprocess.pipe`stdin`.pipe('stdin', pipeOptions));80expectType<ShortcutExecaReturnValue>(await scriptSubprocess.pipe`stdin`.pipe('stdin', pipeOptions));8182expectType<BufferExecaReturnValue>(await execaPromise.pipe('pipe').pipe(execaBufferPromise));83expectType<BufferExecaReturnValue>(await scriptPromise.pipe('pipe').pipe(execaBufferPromise));84expectType<BufferExecaReturnValue>(await execaPromise.pipe('pipe', pipeOptions).pipe(execaBufferPromise));85expectType<BufferExecaReturnValue>(await scriptPromise.pipe('pipe', pipeOptions).pipe(execaBufferPromise));86expectType<BufferExecaReturnValue>(await execaPromise.pipe('pipe').pipe(execaBufferPromise, pipeOptions));87expectType<BufferExecaReturnValue>(await scriptPromise.pipe('pipe').pipe(execaBufferPromise, pipeOptions));82expectType<BufferExecaReturnValue>(await subprocess.pipe('pipe').pipe(bufferSubprocess));83expectType<BufferExecaReturnValue>(await scriptSubprocess.pipe('pipe').pipe(bufferSubprocess));84expectType<BufferExecaReturnValue>(await subprocess.pipe('pipe', pipeOptions).pipe(bufferSubprocess));85expectType<BufferExecaReturnValue>(await scriptSubprocess.pipe('pipe', pipeOptions).pipe(bufferSubprocess));86expectType<BufferExecaReturnValue>(await subprocess.pipe('pipe').pipe(bufferSubprocess, pipeOptions));87expectType<BufferExecaReturnValue>(await scriptSubprocess.pipe('pipe').pipe(bufferSubprocess, pipeOptions));8889expectType<EmptyExecaReturnValue>(await execaPromise.pipe('pipe').pipe`stdin`);90expectType<EmptyExecaReturnValue>(await scriptPromise.pipe('pipe').pipe`stdin`);91expectType<EmptyExecaReturnValue>(await execaPromise.pipe('pipe', pipeOptions).pipe`stdin`);92expectType<EmptyExecaReturnValue>(await scriptPromise.pipe('pipe', pipeOptions).pipe`stdin`);93expectType<ShortcutExecaReturnValue>(await execaPromise.pipe('pipe').pipe(pipeOptions)`stdin`);94expectType<ShortcutExecaReturnValue>(await scriptPromise.pipe('pipe').pipe(pipeOptions)`stdin`);89expectType<EmptyExecaReturnValue>(await subprocess.pipe('pipe').pipe`stdin`);90expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe('pipe').pipe`stdin`);91expectType<EmptyExecaReturnValue>(await subprocess.pipe('pipe', pipeOptions).pipe`stdin`);92expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe('pipe', pipeOptions).pipe`stdin`);93expectType<ShortcutExecaReturnValue>(await subprocess.pipe('pipe').pipe(pipeOptions)`stdin`);94expectType<ShortcutExecaReturnValue>(await scriptSubprocess.pipe('pipe').pipe(pipeOptions)`stdin`);9596expectType<EmptyExecaReturnValue>(await execaPromise.pipe('pipe').pipe('stdin'));97expectType<EmptyExecaReturnValue>(await scriptPromise.pipe('pipe').pipe('stdin'));98expectType<EmptyExecaReturnValue>(await execaPromise.pipe('pipe', pipeOptions).pipe('stdin'));99expectType<EmptyExecaReturnValue>(await scriptPromise.pipe('pipe', pipeOptions).pipe('stdin'));100expectType<ShortcutExecaReturnValue>(await execaPromise.pipe('pipe').pipe('stdin', pipeOptions));101expectType<ShortcutExecaReturnValue>(await scriptPromise.pipe('pipe').pipe('stdin', pipeOptions));96expectType<EmptyExecaReturnValue>(await subprocess.pipe('pipe').pipe('stdin'));97expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe('pipe').pipe('stdin'));98expectType<EmptyExecaReturnValue>(await subprocess.pipe('pipe', pipeOptions).pipe('stdin'));99expectType<EmptyExecaReturnValue>(await scriptSubprocess.pipe('pipe', pipeOptions).pipe('stdin'));100expectType<ShortcutExecaReturnValue>(await subprocess.pipe('pipe').pipe('stdin', pipeOptions));101expectType<ShortcutExecaReturnValue>(await scriptSubprocess.pipe('pipe').pipe('stdin', pipeOptions));102103await execaPromise.pipe(execaBufferPromise, {});104await scriptPromise.pipe(execaBufferPromise, {});105await execaPromise.pipe({})`stdin`;106await scriptPromise.pipe({})`stdin`;107await execaPromise.pipe('stdin', {});108await scriptPromise.pipe('stdin', {});103await subprocess.pipe(bufferSubprocess, {});104await scriptSubprocess.pipe(bufferSubprocess, {});105await subprocess.pipe({})`stdin`;106await scriptSubprocess.pipe({})`stdin`;107await subprocess.pipe('stdin', {});108await scriptSubprocess.pipe('stdin', {});109110expectError(execaPromise.pipe(execaBufferPromise).stdout);111expectError(scriptPromise.pipe(execaBufferPromise).stdout);112expectError(execaPromise.pipe`stdin`.stdout);113expectError(scriptPromise.pipe`stdin`.stdout);114expectError(execaPromise.pipe('stdin').stdout);115expectError(scriptPromise.pipe('stdin').stdout);110expectError(subprocess.pipe(bufferSubprocess).stdout);111expectError(scriptSubprocess.pipe(bufferSubprocess).stdout);112expectError(subprocess.pipe`stdin`.stdout);113expectError(scriptSubprocess.pipe`stdin`.stdout);114expectError(subprocess.pipe('stdin').stdout);115expectError(scriptSubprocess.pipe('stdin').stdout);116117expectError(await execaPromise.pipe({})({}));118expectError(await scriptPromise.pipe({})({}));119expectError(await execaPromise.pipe({})(execaPromise));120expectError(await scriptPromise.pipe({})(execaPromise));121expectError(await execaPromise.pipe({})('stdin'));122expectError(await scriptPromise.pipe({})('stdin'));117expectError(await subprocess.pipe({})({}));118expectError(await scriptSubprocess.pipe({})({}));119expectError(await subprocess.pipe({})(subprocess));120expectError(await scriptSubprocess.pipe({})(subprocess));121expectError(await subprocess.pipe({})('stdin'));122expectError(await scriptSubprocess.pipe({})('stdin'));123124expectError(execaPromise.pipe(createWriteStream('output.txt')));125expectError(scriptPromise.pipe(createWriteStream('output.txt')));126expectError(execaPromise.pipe(false));127expectError(scriptPromise.pipe(false));124expectError(subprocess.pipe(createWriteStream('output.txt')));125expectError(scriptSubprocess.pipe(createWriteStream('output.txt')));126expectError(subprocess.pipe(false));127expectError(scriptSubprocess.pipe(false));128129expectError(execaPromise.pipe(execaBufferPromise, 'stdout'));130expectError(scriptPromise.pipe(execaBufferPromise, 'stdout'));131expectError(execaPromise.pipe('stdout')`stdin`);132expectError(scriptPromise.pipe('stdout')`stdin`);129expectError(subprocess.pipe(bufferSubprocess, 'stdout'));130expectError(scriptSubprocess.pipe(bufferSubprocess, 'stdout'));131expectError(subprocess.pipe('stdout')`stdin`);132expectError(scriptSubprocess.pipe('stdout')`stdin`);133134await execaPromise.pipe(execaBufferPromise, {from: 'stdout'});135await scriptPromise.pipe(execaBufferPromise, {from: 'stdout'});136await execaPromise.pipe({from: 'stdout'})`stdin`;137await scriptPromise.pipe({from: 'stdout'})`stdin`;138await execaPromise.pipe('stdin', {from: 'stdout'});139await scriptPromise.pipe('stdin', {from: 'stdout'});134await subprocess.pipe(bufferSubprocess, {from: 'stdout'});135await scriptSubprocess.pipe(bufferSubprocess, {from: 'stdout'});136await subprocess.pipe({from: 'stdout'})`stdin`;137await scriptSubprocess.pipe({from: 'stdout'})`stdin`;138await subprocess.pipe('stdin', {from: 'stdout'});139await scriptSubprocess.pipe('stdin', {from: 'stdout'});140141await execaPromise.pipe(execaBufferPromise, {from: 'stderr'});142await scriptPromise.pipe(execaBufferPromise, {from: 'stderr'});143await execaPromise.pipe({from: 'stderr'})`stdin`;144await scriptPromise.pipe({from: 'stderr'})`stdin`;145await execaPromise.pipe('stdin', {from: 'stderr'});146await scriptPromise.pipe('stdin', {from: 'stderr'});141await subprocess.pipe(bufferSubprocess, {from: 'stderr'});142await scriptSubprocess.pipe(bufferSubprocess, {from: 'stderr'});143await subprocess.pipe({from: 'stderr'})`stdin`;144await scriptSubprocess.pipe({from: 'stderr'})`stdin`;145await subprocess.pipe('stdin', {from: 'stderr'});146await scriptSubprocess.pipe('stdin', {from: 'stderr'});147148await execaPromise.pipe(execaBufferPromise, {from: 'all'});149await scriptPromise.pipe(execaBufferPromise, {from: 'all'});150await execaPromise.pipe({from: 'all'})`stdin`;151await scriptPromise.pipe({from: 'all'})`stdin`;152await execaPromise.pipe('stdin', {from: 'all'});153await scriptPromise.pipe('stdin', {from: 'all'});148await subprocess.pipe(bufferSubprocess, {from: 'all'});149await scriptSubprocess.pipe(bufferSubprocess, {from: 'all'});150await subprocess.pipe({from: 'all'})`stdin`;151await scriptSubprocess.pipe({from: 'all'})`stdin`;152await subprocess.pipe('stdin', {from: 'all'});153await scriptSubprocess.pipe('stdin', {from: 'all'});154155await execaPromise.pipe(execaBufferPromise, {from: 'fd3'});156await scriptPromise.pipe(execaBufferPromise, {from: 'fd3'});157await execaPromise.pipe({from: 'fd3'})`stdin`;158await scriptPromise.pipe({from: 'fd3'})`stdin`;159await execaPromise.pipe('stdin', {from: 'fd3'});160await scriptPromise.pipe('stdin', {from: 'fd3'});155await subprocess.pipe(bufferSubprocess, {from: 'fd3'});156await scriptSubprocess.pipe(bufferSubprocess, {from: 'fd3'});157await subprocess.pipe({from: 'fd3'})`stdin`;158await scriptSubprocess.pipe({from: 'fd3'})`stdin`;159await subprocess.pipe('stdin', {from: 'fd3'});160await scriptSubprocess.pipe('stdin', {from: 'fd3'});161162expectError(execaPromise.pipe(execaBufferPromise, {from: 'stdin'}));163expectError(scriptPromise.pipe(execaBufferPromise, {from: 'stdin'}));164expectError(execaPromise.pipe({from: 'stdin'})`stdin`);165expectError(scriptPromise.pipe({from: 'stdin'})`stdin`);166expectError(execaPromise.pipe('stdin', {from: 'stdin'}));167expectError(scriptPromise.pipe('stdin', {from: 'stdin'}));162expectError(subprocess.pipe(bufferSubprocess, {from: 'stdin'}));163expectError(scriptSubprocess.pipe(bufferSubprocess, {from: 'stdin'}));164expectError(subprocess.pipe({from: 'stdin'})`stdin`);165expectError(scriptSubprocess.pipe({from: 'stdin'})`stdin`);166expectError(subprocess.pipe('stdin', {from: 'stdin'}));167expectError(scriptSubprocess.pipe('stdin', {from: 'stdin'}));168169await execaPromise.pipe(execaBufferPromise, {to: 'stdin'});170await scriptPromise.pipe(execaBufferPromise, {to: 'stdin'});171await execaPromise.pipe({to: 'stdin'})`stdin`;172await scriptPromise.pipe({to: 'stdin'})`stdin`;173await execaPromise.pipe('stdin', {to: 'stdin'});174await scriptPromise.pipe('stdin', {to: 'stdin'});169await subprocess.pipe(bufferSubprocess, {to: 'stdin'});170await scriptSubprocess.pipe(bufferSubprocess, {to: 'stdin'});171await subprocess.pipe({to: 'stdin'})`stdin`;172await scriptSubprocess.pipe({to: 'stdin'})`stdin`;173await subprocess.pipe('stdin', {to: 'stdin'});174await scriptSubprocess.pipe('stdin', {to: 'stdin'});175176await execaPromise.pipe(execaBufferPromise, {to: 'fd3'});177await scriptPromise.pipe(execaBufferPromise, {to: 'fd3'});178await execaPromise.pipe({to: 'fd3'})`stdin`;179await scriptPromise.pipe({to: 'fd3'})`stdin`;180await execaPromise.pipe('stdin', {to: 'fd3'});181await scriptPromise.pipe('stdin', {to: 'fd3'});176await subprocess.pipe(bufferSubprocess, {to: 'fd3'});177await scriptSubprocess.pipe(bufferSubprocess, {to: 'fd3'});178await subprocess.pipe({to: 'fd3'})`stdin`;179await scriptSubprocess.pipe({to: 'fd3'})`stdin`;180await subprocess.pipe('stdin', {to: 'fd3'});181await scriptSubprocess.pipe('stdin', {to: 'fd3'});182183expectError(execaPromise.pipe(execaBufferPromise, {to: 'stdout'}));184expectError(scriptPromise.pipe(execaBufferPromise, {to: 'stdout'}));185expectError(execaPromise.pipe({to: 'stdout'})`stdin`);186expectError(scriptPromise.pipe({to: 'stdout'})`stdin`);187expectError(execaPromise.pipe('stdin', {to: 'stdout'}));188expectError(scriptPromise.pipe('stdin', {to: 'stdout'}));183expectError(subprocess.pipe(bufferSubprocess, {to: 'stdout'}));184expectError(scriptSubprocess.pipe(bufferSubprocess, {to: 'stdout'}));185expectError(subprocess.pipe({to: 'stdout'})`stdin`);186expectError(scriptSubprocess.pipe({to: 'stdout'})`stdin`);187expectError(subprocess.pipe('stdin', {to: 'stdout'}));188expectError(scriptSubprocess.pipe('stdin', {to: 'stdout'}));189190await execaPromise.pipe(execaBufferPromise, {unpipeSignal: new AbortController().signal});191await scriptPromise.pipe(execaBufferPromise, {unpipeSignal: new AbortController().signal});192await execaPromise.pipe({unpipeSignal: new AbortController().signal})`stdin`;193await scriptPromise.pipe({unpipeSignal: new AbortController().signal})`stdin`;194await execaPromise.pipe('stdin', {unpipeSignal: new AbortController().signal});195await scriptPromise.pipe('stdin', {unpipeSignal: new AbortController().signal});196expectError(await execaPromise.pipe(execaBufferPromise, {unpipeSignal: true}));197expectError(await scriptPromise.pipe(execaBufferPromise, {unpipeSignal: true}));198expectError(await execaPromise.pipe({unpipeSignal: true})`stdin`);199expectError(await scriptPromise.pipe({unpipeSignal: true})`stdin`);200expectError(await execaPromise.pipe('stdin', {unpipeSignal: true}));201expectError(await scriptPromise.pipe('stdin', {unpipeSignal: true}));190await subprocess.pipe(bufferSubprocess, {unpipeSignal: new AbortController().signal});191await scriptSubprocess.pipe(bufferSubprocess, {unpipeSignal: new AbortController().signal});192await subprocess.pipe({unpipeSignal: new AbortController().signal})`stdin`;193await scriptSubprocess.pipe({unpipeSignal: new AbortController().signal})`stdin`;194await subprocess.pipe('stdin', {unpipeSignal: new AbortController().signal});195await scriptSubprocess.pipe('stdin', {unpipeSignal: new AbortController().signal});196expectError(await subprocess.pipe(bufferSubprocess, {unpipeSignal: true}));197expectError(await scriptSubprocess.pipe(bufferSubprocess, {unpipeSignal: true}));198expectError(await subprocess.pipe({unpipeSignal: true})`stdin`);199expectError(await scriptSubprocess.pipe({unpipeSignal: true})`stdin`);200expectError(await subprocess.pipe('stdin', {unpipeSignal: true}));201expectError(await scriptSubprocess.pipe('stdin', {unpipeSignal: true}));202203expectType<EmptyExecaReturnValue>(await execaPromise.pipe('stdin'));204await execaPromise.pipe('stdin');205await execaPromise.pipe(fileUrl);206await execaPromise.pipe('stdin', []);207await execaPromise.pipe('stdin', stringArray);208await execaPromise.pipe('stdin', stringArray, {});209await execaPromise.pipe('stdin', stringArray, {from: 'stderr', to: 'stdin', all: true});210await execaPromise.pipe('stdin', {from: 'stderr'});211await execaPromise.pipe('stdin', {to: 'stdin'});212await execaPromise.pipe('stdin', {all: true});203expectType<EmptyExecaReturnValue>(await subprocess.pipe('stdin'));204await subprocess.pipe('stdin');205await subprocess.pipe(fileUrl);206await subprocess.pipe('stdin', []);207await subprocess.pipe('stdin', stringArray);208await subprocess.pipe('stdin', stringArray, {});209await subprocess.pipe('stdin', stringArray, {from: 'stderr', to: 'stdin', all: true});210await subprocess.pipe('stdin', {from: 'stderr'});211await subprocess.pipe('stdin', {to: 'stdin'});212await subprocess.pipe('stdin', {all: true});213214expectError(await execaPromise.pipe(stringArray));215expectError(await execaPromise.pipe('stdin', 'foo'));216expectError(await execaPromise.pipe('stdin', [false]));217expectError(await execaPromise.pipe('stdin', [], false));218expectError(await execaPromise.pipe('stdin', {other: true}));219expectError(await execaPromise.pipe('stdin', [], {other: true}));220expectError(await execaPromise.pipe('stdin', {from: 'fd'}));221expectError(await execaPromise.pipe('stdin', [], {from: 'fd'}));222expectError(await execaPromise.pipe('stdin', {from: 'fdNotANumber'}));223expectError(await execaPromise.pipe('stdin', [], {from: 'fdNotANumber'}));224expectError(await execaPromise.pipe('stdin', {from: 'other'}));225expectError(await execaPromise.pipe('stdin', [], {from: 'other'}));226expectError(await execaPromise.pipe('stdin', {to: 'fd'}));227expectError(await execaPromise.pipe('stdin', [], {to: 'fd'}));228expectError(await execaPromise.pipe('stdin', {to: 'fdNotANumber'}));229expectError(await execaPromise.pipe('stdin', [], {to: 'fdNotANumber'}));230expectError(await execaPromise.pipe('stdin', {to: 'other'}));231expectError(await execaPromise.pipe('stdin', [], {to: 'other'}));214expectError(await subprocess.pipe(stringArray));215expectError(await subprocess.pipe('stdin', 'foo'));216expectError(await subprocess.pipe('stdin', [false]));217expectError(await subprocess.pipe('stdin', [], false));218expectError(await subprocess.pipe('stdin', {other: true}));219expectError(await subprocess.pipe('stdin', [], {other: true}));220expectError(await subprocess.pipe('stdin', {from: 'fd'}));221expectError(await subprocess.pipe('stdin', [], {from: 'fd'}));222expectError(await subprocess.pipe('stdin', {from: 'fdNotANumber'}));223expectError(await subprocess.pipe('stdin', [], {from: 'fdNotANumber'}));224expectError(await subprocess.pipe('stdin', {from: 'other'}));225expectError(await subprocess.pipe('stdin', [], {from: 'other'}));226expectError(await subprocess.pipe('stdin', {to: 'fd'}));227expectError(await subprocess.pipe('stdin', [], {to: 'fd'}));228expectError(await subprocess.pipe('stdin', {to: 'fdNotANumber'}));229expectError(await subprocess.pipe('stdin', [], {to: 'fdNotANumber'}));230expectError(await subprocess.pipe('stdin', {to: 'other'}));231expectError(await subprocess.pipe('stdin', [], {to: 'other'}));232233const pipeResult = await execaPromise.pipe`stdin`;233const pipeResult = await subprocess.pipe`stdin`;234expectType<string>(pipeResult.stdout);235const ignorePipeResult = await execaPromise.pipe({stdout: 'ignore'})`stdin`;235const ignorePipeResult = await subprocess.pipe({stdout: 'ignore'})`stdin`;236expectType<undefined>(ignorePipeResult.stdout);237238const scriptPipeResult = await scriptPromise.pipe`stdin`;238const scriptPipeResult = await scriptSubprocess.pipe`stdin`;239expectType<string>(scriptPipeResult.stdout);240const ignoreScriptPipeResult = await scriptPromise.pipe({stdout: 'ignore'})`stdin`;240const ignoreScriptPipeResult = await scriptSubprocess.pipe({stdout: 'ignore'})`stdin`;241expectType<undefined>(ignoreScriptPipeResult.stdout);242243const shortcutPipeResult = await execaPromise.pipe('stdin');243const shortcutPipeResult = await subprocess.pipe('stdin');244expectType<string>(shortcutPipeResult.stdout);245const ignoreShortcutPipeResult = await execaPromise.pipe('stdin', {stdout: 'ignore'});245const ignoreShortcutPipeResult = await subprocess.pipe('stdin', {stdout: 'ignore'});246expectType<undefined>(ignoreShortcutPipeResult.stdout);247248const scriptShortcutPipeResult = await scriptPromise.pipe('stdin');248const scriptShortcutPipeResult = await scriptSubprocess.pipe('stdin');249expectType<string>(scriptShortcutPipeResult.stdout);250const ignoreShortcutScriptPipeResult = await scriptPromise.pipe('stdin', {stdout: 'ignore'});250const ignoreShortcutScriptPipeResult = await scriptSubprocess.pipe('stdin', {stdout: 'ignore'});251expectType<undefined>(ignoreShortcutScriptPipeResult.stdout);252253const unicornsResult = execaSync('unicorns');254expectError(unicornsResult.pipe);
modified:types/methods/command.d.ts+9 added-9 removed
1import type {Options, SyncOptions} from '../arguments/options';2import type {ExecaSyncResult} from '../return/result';3import type {ExecaSubprocess} from '../subprocess/subprocess';3import type {ExecaResultPromise} from '../subprocess/subprocess';4import type {SimpleTemplateString} from './template';56type ExecaCommand<OptionsType extends Options> = {7 <NewOptionsType extends Options = {}>(options: NewOptionsType): ExecaCommand<OptionsType & NewOptionsType>;89 (...templateString: SimpleTemplateString): ExecaSubprocess<OptionsType>;9 (...templateString: SimpleTemplateString): ExecaResultPromise<OptionsType>;1011 <NewOptionsType extends Options = {}>(12 command: string,13 options?: NewOptionsType,14 ): ExecaSubprocess<OptionsType & NewOptionsType>;14 ): ExecaResultPromise<OptionsType & NewOptionsType>;15};1617/**18Executes a command. `command` is a string that includes both the `file` and its `arguments`.
2 unmodified lines
2122Just like `execa()`, this can bind options. It can also be run synchronously using `execaCommandSync()`.2324@param command - The program/script to execute and its arguments.25@returns An `ExecaSubprocess` that is both:26- a `Promise` resolving or rejecting with a subprocess `result`.27- a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with some additional methods and properties.28@throws A subprocess `result` error25@returns An `ExecaResultPromise` that is both:26- the subprocess.27- a `Promise` either resolving with its successful `result`, or rejecting with its `error`.28@throws `ExecaError`2930@example31```32import {execaCommand} from 'execa';
21 unmodified lines
5455Returns or throws a subprocess `result`. The `subprocess` is not returned: its methods and properties are not available.5657@param command - The program/script to execute and its arguments.58@returns A subprocess `result` object59@throws A subprocess `result` error58@returns `ExecaSyncResult`59@throws `ExecaSyncError`6061@example62```63import {execaCommandSync} from 'execa';
7 unmodified lines
modified:types/methods/main-async.d.ts+8 added-8 removed
1import type {Options} from '../arguments/options';2import type {ExecaSubprocess} from '../subprocess/subprocess';2import type {ExecaResultPromise} from '../subprocess/subprocess';3import type {TemplateString} from './template';45type Execa<OptionsType extends Options> = {6 <NewOptionsType extends Options = {}>(options: NewOptionsType): Execa<OptionsType & NewOptionsType>;78 (...templateString: TemplateString): ExecaSubprocess<OptionsType>;8 (...templateString: TemplateString): ExecaResultPromise<OptionsType>;910 <NewOptionsType extends Options = {}>(11 file: string | URL,12 arguments?: readonly string[],13 options?: NewOptionsType,14 ): ExecaSubprocess<OptionsType & NewOptionsType>;14 ): ExecaResultPromise<OptionsType & NewOptionsType>;1516 <NewOptionsType extends Options = {}>(17 file: string | URL,18 options?: NewOptionsType,19 ): ExecaSubprocess<OptionsType & NewOptionsType>;19 ): ExecaResultPromise<OptionsType & NewOptionsType>;20};2122/**23Executes a command using `file ...arguments`.
3 unmodified lines
27`execa(options)` can be used to return a new instance of Execa but with different default `options`. Consecutive calls are merged to previous ones.2829@param file - The program/script to execute, as a string or file URL30@param arguments - Arguments to pass to `file` on execution.31@returns An `ExecaSubprocess` that is both:32- a `Promise` resolving or rejecting with a subprocess `result`.33- a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with some additional methods and properties.34@throws A subprocess `result` error31@returns An `ExecaResultPromise` that is both:32- the subprocess.33- a `Promise` either resolving with its successful `result`, or rejecting with its `error`.34@throws `ExecaError`3536@example <caption>Simple syntax</caption>3738```
204 unmodified lines
modified:types/methods/main-sync.d.ts+2 added-2 removed
24 unmodified lines
25Returns or throws a subprocess `result`. The `subprocess` is not returned: its methods and properties are not available.2627@param file - The program/script to execute, as a string or file URL28@param arguments - Arguments to pass to `file` on execution.29@returns A subprocess `result` object30@throws A subprocess `result` error29@returns `ExecaSyncResult`30@throws `ExecaSyncError`3132@example3334```
8 unmodified lines
modified:types/methods/node.d.ts+8 added-8 removed
1import type {Options} from '../arguments/options';2import type {ExecaSubprocess} from '../subprocess/subprocess';2import type {ExecaResultPromise} from '../subprocess/subprocess';3import type {TemplateString} from './template';45type ExecaNode<OptionsType extends Options> = {6 <NewOptionsType extends Options = {}>(options: NewOptionsType): ExecaNode<OptionsType & NewOptionsType>;78 (...templateString: TemplateString): ExecaSubprocess<OptionsType>;8 (...templateString: TemplateString): ExecaResultPromise<OptionsType>;910 <NewOptionsType extends Options = {}>(11 scriptPath: string | URL,12 arguments?: readonly string[],13 options?: NewOptionsType,14 ): ExecaSubprocess<OptionsType & NewOptionsType>;14 ): ExecaResultPromise<OptionsType & NewOptionsType>;1516 <NewOptionsType extends Options = {}>(17 scriptPath: string | URL,18 options?: NewOptionsType,19 ): ExecaSubprocess<OptionsType & NewOptionsType>;19 ): ExecaResultPromise<OptionsType & NewOptionsType>;20};2122/**23Same as `execa()` but using the `node: true` option.
4 unmodified lines
28This is the preferred method when executing Node.js files.2930@param scriptPath - Node.js script to execute, as a string or file URL31@param arguments - Arguments to pass to `scriptPath` on execution.32@returns An `ExecaSubprocess` that is both:33- a `Promise` resolving or rejecting with a subprocess `result`.34- a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with some additional methods and properties.35@throws A subprocess `result` error32@returns An `ExecaResultPromise` that is both:33- the subprocess.34- a `Promise` either resolving with its successful `result`, or rejecting with its `error`.35@throws `ExecaError`3637@example38```39import {execaNode, execa} from 'execa';
9 unmodified lines
modified:types/methods/script.d.ts+8 added-8 removed
3 unmodified lines
4 SyncOptions,5 StricterOptions,6} from '../arguments/options';7import type {ExecaSyncResult} from '../return/result';8import type {ExecaSubprocess} from '../subprocess/subprocess';8import type {ExecaResultPromise} from '../subprocess/subprocess';9import type {TemplateString} from './template';1011type ExecaScriptCommon<OptionsType extends CommonOptions> = {12 <NewOptionsType extends CommonOptions = {}>(options: NewOptionsType): ExecaScript<OptionsType & NewOptionsType>;1314 (...templateString: TemplateString): ExecaSubprocess<StricterOptions<OptionsType, Options>>;14 (...templateString: TemplateString): ExecaResultPromise<StricterOptions<OptionsType, Options>>;1516 <NewOptionsType extends Options = {}>(17 file: string | URL,18 arguments?: readonly string[],19 options?: NewOptionsType,20 ): ExecaSubprocess<StricterOptions<OptionsType & NewOptionsType, Options>>;20 ): ExecaResultPromise<StricterOptions<OptionsType & NewOptionsType, Options>>;2122 <NewOptionsType extends Options = {}>(23 file: string | URL,24 options?: NewOptionsType,25 ): ExecaSubprocess<StricterOptions<OptionsType & NewOptionsType, Options>>;25 ): ExecaResultPromise<StricterOptions<OptionsType & NewOptionsType, Options>>;26};2728type ExecaScriptSync<OptionsType extends CommonOptions> = {29 <NewOptionsType extends SyncOptions = {}>(options: NewOptionsType): ExecaScriptSync<OptionsType & NewOptionsType>;
23 unmodified lines
53Just like `execa()`, this can use the template string syntax or bind options. It can also be run synchronously using `$.sync()` or `$.s()`.5455This is the preferred method when executing multiple commands in a script file.5657@returns An `ExecaSubprocess` that is both:58 - a `Promise` resolving or rejecting with a subprocess `result`.59 - a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with some additional methods and properties.60@throws A subprocess `result` error57@returns An `ExecaResultPromise` that is both:58- the subprocess.59- a `Promise` either resolving with its successful `result`, or rejecting with its `error`.60@throws `ExecaError`6162@example <caption>Basic</caption>63```64import {$} from 'execa';
26 unmodified lines
modified:types/subprocess/subprocess.d.ts+16 added-4 removed
18 unmodified lines
19 : OptionsType['stdio'] extends StdioOptionsArray20 ? 'ipc' extends OptionsType['stdio'][number] ? true : false21 : false;2223export type ExecaResultPromise<OptionsType extends Options = Options> = {23type ExecaCustomSubprocess<OptionsType extends Options = Options> = {24 /**25 Process identifier ([PID](https://en.wikipedia.org/wiki/Process_identifier)).2627 This is `undefined` if the subprocess failed to spawn.
86 unmodified lines
114 */115 duplex(duplexOptions?: DuplexOptions): Duplex;116} & PipableSubprocess;117118export type ExecaSubprocess<OptionsType extends Options = Options> = Omit<ChildProcess, keyof ExecaResultPromise<OptionsType>> &119ExecaResultPromise<OptionsType> &120Promise<ExecaResult<OptionsType>>;118/**119[`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with additional methods and properties.120*/121export type ExecaSubprocess<OptionsType extends Options = Options> =122 & Omit<ChildProcess, keyof ExecaCustomSubprocess<OptionsType>>123 & ExecaCustomSubprocess<OptionsType>;124125/**126The return value of all asynchronous methods is both:127- the subprocess.128- a `Promise` either resolving with its successful `result`, or rejecting with its `error`.129*/130export type ExecaResultPromise<OptionsType extends Options = Options> =131 & ExecaSubprocess<OptionsType>132 & Promise<ExecaResult<OptionsType>>;
modified:types/pipe.d.ts+2 added-2 removed
1import type {Options} from './arguments/options';2import type {ExecaResult} from './return/result';3import type {FromOption, ToOption} from './arguments/fd-options';4import type {ExecaSubprocess} from './subprocess/subprocess';4import type {ExecaResultPromise} from './subprocess/subprocess';5import type {TemplateExpression} from './methods/template';67// `subprocess.pipe()` options8type PipeOptions = {
43 unmodified lines
5253 /**54 Like `subprocess.pipe(file, arguments?, options?)` but using the return value of another `execa()` call instead.55 */56 pipe<Destination extends ExecaSubprocess>(destination: Destination, options?: PipeOptions):56 pipe<Destination extends ExecaResultPromise>(destination: Destination, options?: PipeOptions):57 Promise<Awaited<Destination>> & PipableSubprocess;58};