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
Provenance
- Commit
95e5754- Tree
a48d1d1- Author
ehmicky <ehmicky@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
282d189
3 files changed+10 added−6 removed
modified:index.d.ts+3 added-1 removed
411 unmodified lines412 escapedCommand: string;413 414 /**415 The numeric exit code of the process that was run.416+417+ 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;420 421 /**422 The output of the process on `stdout`.423 662 unmodified linesmodified:index.test-d.ts+4 added-4 removed
58 unmodified lines59 60 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 lines74 } catch (error: unknown) {75 const execaError = error as ExecaError;76 77 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 lines93 try {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 lines111 } catch (error: unknown) {112 const execaError = error as ExecaSyncError;113 114 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 linesmodified:readme.md+3 added-1 removed
398 unmodified lines399 Since the escaping is fairly basic, this should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execaCommand()`](#execacommandcommand-options).400 401 #### exitCode402 403-Type: `number`403+Type: `number | undefined`404 405 The numeric exit code of the process that was run.406 407+This is `undefined` when the process could not be spawned or was terminated by a [signal](#signal-1).408+409 #### stdout410 411 Type: `string | Uint8Array | undefined`412 517 unmodified lines