Skip to content
Myr

Document and type `exitCode` being `undefined` (#680)

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

authored by ehmicky · committed by GitHub · parent 282d189 · Browse files · 3 files+10 added−6 removed
This commit

State

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

Diff stats

3 files+10 added−6 removed

  • other:+10 added−6 removed

3 files+10 added−6 removed

modified:index.d.ts+3 added-1 removed
411 unmodified lines
412 escapedCommand: string;413414 /**415 The numeric exit code of the process that was run.416417 This is `undefined` when the process could not be spawned or was terminated by a [signal](#signal-1).418 */417 exitCode: number;419 exitCode?: number;420421 /**422 The output of the process on `stdout`.423
662 unmodified lines
modified:index.test-d.ts+4 added-4 removed
58 unmodified lines
5960 const unicornsResult = await execaPromise;61 expectType<string>(unicornsResult.command);62 expectType<string>(unicornsResult.escapedCommand);63 expectType<number>(unicornsResult.exitCode);63 expectType<number | undefined>(unicornsResult.exitCode);64 expectType<string>(unicornsResult.stdout);65 expectType<string>(unicornsResult.stderr);66 expectType<string | undefined>(unicornsResult.all);67 expectType<boolean>(unicornsResult.failed);
6 unmodified lines
74} catch (error: unknown) {75 const execaError = error as ExecaError;7677 expectType<string>(execaError.message);78 expectType<number>(execaError.exitCode);78 expectType<number | undefined>(execaError.exitCode);79 expectType<string>(execaError.stdout);80 expectType<string>(execaError.stderr);81 expectType<string | undefined>(execaError.all);82 expectType<boolean>(execaError.failed);
10 unmodified lines
93try {94 const unicornsResult = execaSync('unicorns');95 expectType<string>(unicornsResult.command);96 expectType<string>(unicornsResult.escapedCommand);97 expectType<number>(unicornsResult.exitCode);97 expectType<number | undefined>(unicornsResult.exitCode);98 expectType<string>(unicornsResult.stdout);99 expectType<string>(unicornsResult.stderr);100 expectError(unicornsResult.all);101 expectError(unicornsResult.pipeStdout);
9 unmodified lines
111} catch (error: unknown) {112 const execaError = error as ExecaSyncError;113114 expectType<string>(execaError.message);115 expectType<number>(execaError.exitCode);115 expectType<number | undefined>(execaError.exitCode);116 expectType<string>(execaError.stdout);117 expectType<string>(execaError.stderr);118 expectError(execaError.all);119 expectType<boolean>(execaError.failed);
366 unmodified lines
modified:readme.md+3 added-1 removed
398 unmodified lines
399Since the escaping is fairly basic, this should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execaCommand()`](#execacommandcommand-options).400401#### exitCode402403Type: `number`403Type: `number | undefined`404405The numeric exit code of the process that was run.406407This is `undefined` when the process could not be spawned or was terminated by a [signal](#signal-1).408409#### stdout410411Type: `string | Uint8Array | undefined`412
517 unmodified lines