Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add result.all TypeScript definition #345

Merged
merged 2 commits into from Jul 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions index.d.ts
Expand Up @@ -321,6 +321,13 @@ declare namespace execa {
Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal). This is preferred when cancelling the child process execution as the error is more descriptive and [`childProcessResult.isCanceled`](#iscanceled) is set to `true`.
*/
cancel(): void;

/**
Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).

This is `undefined` when both `stdout` and `stderr` options are set to [`'pipe'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
*/
all?: ReadableStream;
}

type ExecaChildProcess<StdoutErrorType = string> = ChildProcess &
Expand Down
2 changes: 2 additions & 0 deletions index.test-d.ts
@@ -1,4 +1,5 @@
import {expectType, expectError} from 'tsd';
import {Readable as ReadableStream} from 'stream'
import execa = require('.');
import {
ExecaReturnValue,
Expand All @@ -11,6 +12,7 @@ import {
try {
const execaPromise = execa('unicorns');
execaPromise.cancel();
expectType<ReadableStream | undefined>(execaPromise.all)

const unicornsResult = await execaPromise;
expectType<string>(unicornsResult.command);
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Expand Up @@ -164,8 +164,12 @@ Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#chi

#### all

Type: `ReadableStream | undefined`
ehmicky marked this conversation as resolved.
Show resolved Hide resolved

Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).

This is `undefined` when both [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options are set to [`'pipe'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).

### execa.sync(file, [arguments], [options])

Execute a file synchronously.
Expand Down