Skip to content

Commit

Permalink
Reorder properties in documentation too
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 14, 2019
1 parent 0595f9f commit e5681a1
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 39 deletions.
20 changes: 10 additions & 10 deletions index.d.ts
Expand Up @@ -194,6 +194,11 @@ declare namespace execa {
}

interface ExecaReturnBase<StdoutStderrType> {
/**
The command that was run.
*/
command: string;

/**
The numeric exit code of the process that was run.
*/
Expand All @@ -219,16 +224,6 @@ declare namespace execa {
*/
failed: boolean;

/**
The signal that was used to terminate the process.
*/
signal?: string;

/**
The command that was run.
*/
command: string;

/**
Whether the process timed out.
*/
Expand All @@ -238,6 +233,11 @@ declare namespace execa {
Whether the process was killed.
*/
killed: boolean;

/**
The signal that was used to terminate the process.
*/
signal?: string;
}

interface ExecaSyncReturnValue<StdoutErrorType = string>
Expand Down
14 changes: 7 additions & 7 deletions index.test-d.ts
Expand Up @@ -15,14 +15,14 @@ try {
const unicornsResult = await execaPromise;
expectType<string>(unicornsResult.command);
expectType<string | number>(unicornsResult.code);
expectType<boolean>(unicornsResult.failed);
expectType<boolean>(unicornsResult.killed);
expectType<string | undefined>(unicornsResult.signal);
expectType<string>(unicornsResult.stderr);
expectType<string>(unicornsResult.stdout);
expectType<string>(unicornsResult.all);
expectType<boolean>(unicornsResult.failed);
expectType<boolean>(unicornsResult.timedOut);
expectType<boolean>(unicornsResult.isCanceled);
expectType<boolean>(unicornsResult.killed);
expectType<string | undefined>(unicornsResult.signal);
} catch (error) {
const execaError: ExecaError = error;

Expand All @@ -36,14 +36,14 @@ try {
const unicornsResult = execa.sync('unicorns');
expectType<string>(unicornsResult.command);
expectType<string | number>(unicornsResult.code);
expectType<boolean>(unicornsResult.failed);
expectType<boolean>(unicornsResult.killed);
expectType<string | undefined>(unicornsResult.signal);
expectType<string>(unicornsResult.stderr);
expectType<string>(unicornsResult.stdout);
expectType<boolean>(unicornsResult.timedOut);
expectError(unicornsResult.all);
expectType<boolean>(unicornsResult.failed);
expectType<boolean>(unicornsResult.timedOut);
expectError(unicornsResult.isCanceled);
expectType<boolean>(unicornsResult.killed);
expectType<string | undefined>(unicornsResult.signal);
} catch (error) {
const execaError: ExecaSyncError = error;

Expand Down
57 changes: 35 additions & 22 deletions readme.md
Expand Up @@ -60,18 +60,22 @@ const execa = require('execa');
console.log(error);
/*
{
message: 'spawn wrong command ENOENT',
message: 'Command failed with exit code 2 (ENOENT): wrong command spawn wrong ENOENT',
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn wrong command',
path: 'wrong command',
killed: false,
code: 2,
syscall: 'spawn wrong',
path: 'wrong',
spawnargs: ['command'],
command: 'wrong command',
exitCode: 2,
exitCodeName: 'ENOENT',
stdout: '',
stderr: '',
all: '',
failed: true,
signal: null,
cmd: 'wrong command',
timedOut: false
timedOut: false,
isCanceled: false,
killed: false
}
*/
}
Expand All @@ -96,11 +100,20 @@ try {
console.log(error);
/*
{
message: 'spawnSync wrong command ENOENT',
message: 'Command failed with exit code 2 (ENOENT): wrong command spawnSync wrong ENOENT',
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawnSync wrong command',
path: 'wrong command',
code: 2,
syscall: 'spawnSync wrong',
path: 'wrong',
spawnargs: ['command'],
command: 'wrong command',
exitCode: 2,
exitCodeName: 'ENOENT',
stdout: null,
stderr: null,
failed: true,
timedOut: false,
isCanceled: false
}
*/
}
Expand Down Expand Up @@ -147,6 +160,12 @@ Type: `object`

Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.

#### command

Type: `string`

The command that was run.

#### exitCode

Type: `number`
Expand Down Expand Up @@ -177,12 +196,6 @@ Type: `string | Buffer`

The output of the process on both stdout and stderr. `undefined` if `execa.sync()` was used.

#### command

Type: `string`

The command that was run.

#### failed

Type: `boolean`
Expand All @@ -195,17 +208,17 @@ Type: `boolean`

Whether the process timed out.

#### killed
#### isCanceled

Type: `boolean`

Whether the process was killed.
Whether the process was canceled.

#### isCanceled
#### killed

Type: `boolean`

Whether the process was canceled.
Whether the process was killed.

#### signal

Expand Down

0 comments on commit e5681a1

Please sign in to comment.