Skip to content
Myr

Add `result|error.durationMs` (#896)

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

authored by ehmicky · committed by GitHub · parent 6a7a82c · Browse files · 20 files+181 added−72 removed
This commit

State

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

Diff stats

20 files+181 added−72 removed

  • tests:+74 added−6 removed
  • other:+107 added−66 removed

20 files+181 added−72 removed

modified:lib/arguments/options.js+3 added-1 removed
modified:lib/pipe/abort.js+2 added-2 removed
modified:lib/pipe/setup.js+3 added-1 removed
modified:lib/pipe/throw.js+4 added-2 removed
6 unmodified lines
7 destinationStream,8 destinationError,9 stdioStreamsGroups,10 sourceOptions,11 startTime,12}) => {13 const error = getPipeArgumentsError({sourceStream, sourceError, destinationStream, destinationError});14 if (error !== undefined) {14 throw createNonCommandError({error, stdioStreamsGroups, sourceOptions});15 throw createNonCommandError({error, stdioStreamsGroups, sourceOptions, startTime});16 }17};1819const getPipeArgumentsError = ({sourceStream, sourceError, destinationStream, destinationError}) => {
11 unmodified lines
31 return sourceError;32 }33};3434export const createNonCommandError = ({error, stdioStreamsGroups, sourceOptions}) => makeEarlyError({35export const createNonCommandError = ({error, stdioStreamsGroups, sourceOptions, startTime}) => makeEarlyError({36 error,37 command: PIPE_COMMAND_MESSAGE,38 escapedCommand: PIPE_COMMAND_MESSAGE,39 stdioStreamsGroups,40 options: sourceOptions,41 startTime,42});4344const PIPE_COMMAND_MESSAGE = 'source.pipe(destination)';
modified:lib/pipe/validate.js+3 added
1import {execa} from '../async.js';2import {create$} from '../script.js';3import {normalizeArguments} from '../arguments/options.js';4import {STANDARD_STREAMS_ALIASES} from '../utils.js';5import {getStartTime} from '../return/duration.js';67export const normalizePipeArguments = ({source, sourcePromise, stdioStreamsGroups, destinationOptions}, ...args) => {8 const startTime = getStartTime();9 const sourceOptions = PROCESS_OPTIONS.get(source);10 const {11 destination,12 destinationStream,
10 unmodified lines
23 destinationStream,24 destinationError,25 unpipeSignal,26 stdioStreamsGroups,27 startTime,28 };29};3031const getDestinationStream = (destinationOptions, ...args) => {
123 unmodified lines
added:lib/return/duration.js+5 added
modified:lib/return/early-error.js+2 added-2 removed
4 unmodified lines
5import {handleResult} from './output.js';67// When the child process fails to spawn.8// We ensure the returned error is always both a promise and a child process.9export const handleEarlyError = ({error, command, escapedCommand, stdioStreamsGroups, options, verboseInfo}) => {9export const handleEarlyError = ({error, command, escapedCommand, stdioStreamsGroups, options, startTime, verboseInfo}) => {10 cleanupStdioStreams(stdioStreamsGroups);1112 const spawned = new ChildProcess();13 createDummyStreams(spawned);1415 const earlyError = makeEarlyError({error, command, escapedCommand, stdioStreamsGroups, options});15 const earlyError = makeEarlyError({error, command, escapedCommand, stdioStreamsGroups, options, startTime});16 const promise = handleDummyPromise(earlyError, verboseInfo, options);17 return {spawned, promise};18};19
16 unmodified lines
modified:lib/return/error.js+7 added
1 unmodified line
2import stripFinalNewline from 'strip-final-newline';3import {isBinary, binaryToString} from '../utils.js';4import {fixCwdError} from '../arguments/cwd.js';5import {escapeLines} from '../arguments/escape.js';6import {getDurationMs} from './duration.js';7import {getFinalError, isPreviousError} from './clone.js';89export const makeSuccessResult = ({10 command,11 escapedCommand,12 stdio,13 all,14 options: {cwd},15 startTime,16}) => ({17 command,18 escapedCommand,19 cwd,20 durationMs: getDurationMs(startTime),21 failed: false,22 timedOut: false,23 isCanceled: false,24 isTerminated: false,
10 unmodified lines
35 command,36 escapedCommand,37 stdioStreamsGroups,38 options,39 startTime,40}) => makeError({41 error,42 command,43 escapedCommand,44 startTime,45 timedOut: false,46 isCanceled: false,47 stdio: Array.from({length: stdioStreamsGroups.length}),48 options,
2 unmodified lines
51export const makeError = ({52 error: rawError,53 command,54 escapedCommand,55 startTime,56 timedOut,57 isCanceled,58 exitCode: rawExitCode,59 signal: rawSignal,
22 unmodified lines
82 error.originalMessage = originalMessage;83 error.command = command;84 error.escapedCommand = escapedCommand;85 error.cwd = cwd;86 error.durationMs = getDurationMs(startTime);8788 error.failed = true;89 error.timedOut = timedOut;90 error.isCanceled = isCanceled;
109 unmodified lines
modified:lib/verbose/complete.js+14 added-9 removed
1import prettyMs from 'pretty-ms';2import {gray} from 'yoctocolors';3import {escapeLines} from '../arguments/escape.js';4import {getDurationMs} from '../return/duration.js';5import {verboseLog} from './log.js';5import {getCommandDuration} from './info.js';6import {logError} from './error.js';78// When `verbose` is `short|full`, print each command's completion, duration and error9export const logFinalResult = ({shortMessage, failed}, reject, verboseInfo) => {10 logResult(shortMessage, failed, reject, verboseInfo);9export const logFinalResult = ({shortMessage, failed, durationMs}, reject, verboseInfo) => {10 logResult({message: shortMessage, failed, reject, durationMs, verboseInfo});11};1213// Same but for early validation errors14export const logEarlyResult = (error, verboseInfo) => {15 logResult(escapeLines(String(error)), true, true, verboseInfo);14export const logEarlyResult = (error, startTime, verboseInfo) => {15 logResult({16 message: escapeLines(String(error)),17 failed: true,18 reject: true,19 durationMs: getDurationMs(startTime),20 verboseInfo,21 });22};2318const logResult = (message, failed, reject, {verbose, verboseId, startTime}) => {24const logResult = ({message, failed, reject, durationMs, verboseInfo: {verbose, verboseId}}) => {25 if (verbose === 'none') {26 return;27 }2829 const icon = getIcon(failed, reject);30 logError({message, failed, reject, verboseId, icon});25 logDuration(startTime, verboseId, icon);31 logDuration(durationMs, verboseId, icon);32};3328const logDuration = (startTime, verboseId, icon) => {29 const durationMs = getCommandDuration(startTime);34const logDuration = (durationMs, verboseId, icon) => {35 const durationMessage = `(done in ${prettyMs(durationMs)})`;36 verboseLog(durationMessage, verboseId, icon, gray);37};38
7 unmodified lines
modified:lib/verbose/info.js+3 added-12 removed
1import {hrtime} from 'node:process';1import {debuglog} from 'node:util';24export const getVerboseInfo = ({verbose = verboseDefault}) => {5 if (verbose === 'none') {6 return {verbose};7 }3export const getVerboseInfo = ({verbose = verboseDefault}) => verbose === 'none'4 ? {verbose}5 : {verbose, verboseId: VERBOSE_ID++};69 const verboseId = VERBOSE_ID++;10 const startTime = hrtime.bigint();11 return {verbose, verboseId, startTime};12};137const verboseDefault = debuglog('execa').enabled ? 'full' : 'none';816export const getCommandDuration = startTime => Number(hrtime.bigint() - startTime) / 1e6;179// Prepending the `pid` is useful when multiple commands print their output at the same time.10// However, we cannot use the real PID since this is not available with `child_process.spawnSync()`.11// Also, we cannot use the real PID if we want to print it before `child_process.spawn()` is run.12// As a pro, it is shorter than a normal PID and never re-uses the same id.
2 unmodified lines
modified:lib/async.js+13 added-12 removed
13 unmodified lines
14import {getSpawnedResult} from './stream/resolve.js';15import {mergePromise} from './promise.js';1617export const execa = (rawFile, rawArgs, rawOptions) => {18 const {file, args, command, escapedCommand, verboseInfo, options, stdioStreamsGroups, stdioState} = handleAsyncArguments(rawFile, rawArgs, rawOptions);19 const {spawned, promise} = spawnProcessAsync({file, args, options, verboseInfo, command, escapedCommand, stdioStreamsGroups, stdioState});18 const {file, args, command, escapedCommand, startTime, verboseInfo, options, stdioStreamsGroups, stdioState} = handleAsyncArguments(rawFile, rawArgs, rawOptions);19 const {spawned, promise} = spawnProcessAsync({file, args, options, startTime, verboseInfo, command, escapedCommand, stdioStreamsGroups, stdioState});20 spawned.pipe = pipeToProcess.bind(undefined, {source: spawned, sourcePromise: promise, stdioStreamsGroups, destinationOptions: {}});21 mergePromise(spawned, promise);22 PROCESS_OPTIONS.set(spawned, options);23 return spawned;24};2526const handleAsyncArguments = (rawFile, rawArgs, rawOptions) => {27 [rawFile, rawArgs, rawOptions] = normalizeArguments(rawFile, rawArgs, rawOptions);28 const {command, escapedCommand, verboseInfo} = handleCommand(rawFile, rawArgs, rawOptions);28 const {command, escapedCommand, startTime, verboseInfo} = handleCommand(rawFile, rawArgs, rawOptions);2930 try {31 const {file, args, options: normalizedOptions} = handleArguments(rawFile, rawArgs, rawOptions);32 const options = handleAsyncOptions(normalizedOptions);33 const {stdioStreamsGroups, stdioState} = handleInputAsync(options, verboseInfo);34 return {file, args, command, escapedCommand, verboseInfo, options, stdioStreamsGroups, stdioState};34 return {file, args, command, escapedCommand, startTime, verboseInfo, options, stdioStreamsGroups, stdioState};35 } catch (error) {36 logEarlyResult(error, verboseInfo);36 logEarlyResult(error, startTime, verboseInfo);37 throw error;38 }39};40
5 unmodified lines
4647 return {...options, timeoutDuration: timeout, signal: cancelSignal};48};4950const spawnProcessAsync = ({file, args, options, verboseInfo, command, escapedCommand, stdioStreamsGroups, stdioState}) => {50const spawnProcessAsync = ({file, args, options, startTime, verboseInfo, command, escapedCommand, stdioStreamsGroups, stdioState}) => {51 let spawned;52 try {53 spawned = spawn(file, args, options);54 } catch (error) {55 return handleEarlyError({error, command, escapedCommand, stdioStreamsGroups, options, verboseInfo});55 return handleEarlyError({error, command, escapedCommand, stdioStreamsGroups, options, startTime, verboseInfo});56 }5758 const controller = new AbortController();59 setMaxListeners(Number.POSITIVE_INFINITY, controller.signal);
4 unmodified lines
6465 spawned.kill = spawnedKill.bind(undefined, {kill: spawned.kill.bind(spawned), spawned, options, controller});66 spawned.all = makeAllStream(spawned, options);6768 const promise = handlePromise({spawned, options, verboseInfo, stdioStreamsGroups, originalStreams, command, escapedCommand, controller});68 const promise = handlePromise({spawned, options, startTime, verboseInfo, stdioStreamsGroups, originalStreams, command, escapedCommand, controller});69 return {spawned, promise};70};7172const handlePromise = async ({spawned, options, verboseInfo, stdioStreamsGroups, originalStreams, command, escapedCommand, controller}) => {72const handlePromise = async ({spawned, options, startTime, verboseInfo, stdioStreamsGroups, originalStreams, command, escapedCommand, controller}) => {73 const context = {timedOut: false};7475 const [76 errorInfo,
4 unmodified lines
81 controller.abort();8283 const stdio = stdioResults.map(stdioResult => handleOutput(options, stdioResult));84 const all = handleOutput(options, allResult);85 const result = getAsyncResult({errorInfo, exitCode, signal, stdio, all, context, options, command, escapedCommand});85 const result = getAsyncResult({errorInfo, exitCode, signal, stdio, all, context, options, command, escapedCommand, startTime});86 return handleResult(result, verboseInfo, options);87};8889const getAsyncResult = ({errorInfo, exitCode, signal, stdio, all, context, options, command, escapedCommand}) => 'error' in errorInfo89const getAsyncResult = ({errorInfo, exitCode, signal, stdio, all, context, options, command, escapedCommand, startTime}) => 'error' in errorInfo90 ? makeError({91 error: errorInfo.error,92 command,93 escapedCommand,
3 unmodified lines
97 signal,98 stdio,99 all,100 options,101 startTime,102 })102 : makeSuccessResult({command, escapedCommand, stdio, all, options});103 : makeSuccessResult({command, escapedCommand, stdio, all, options, startTime});
modified:lib/sync.js+11 added-10 removed
5 unmodified lines
6import {logEarlyResult} from './verbose/complete.js';7import {isFailedExit} from './exit/code.js';89export const execaSync = (rawFile, rawArgs, rawOptions) => {10 const {file, args, command, escapedCommand, verboseInfo, options, stdioStreamsGroups} = handleSyncArguments(rawFile, rawArgs, rawOptions);11 const result = spawnProcessSync({file, args, options, command, escapedCommand, stdioStreamsGroups});10 const {file, args, command, escapedCommand, startTime, verboseInfo, options, stdioStreamsGroups} = handleSyncArguments(rawFile, rawArgs, rawOptions);11 const result = spawnProcessSync({file, args, options, command, escapedCommand, stdioStreamsGroups, startTime});12 return handleResult(result, verboseInfo, options);13};1415const handleSyncArguments = (rawFile, rawArgs, rawOptions) => {16 [rawFile, rawArgs, rawOptions] = normalizeArguments(rawFile, rawArgs, rawOptions);17 const {command, escapedCommand, verboseInfo} = handleCommand(rawFile, rawArgs, rawOptions);17 const {command, escapedCommand, startTime, verboseInfo} = handleCommand(rawFile, rawArgs, rawOptions);1819 try {20 const syncOptions = normalizeSyncOptions(rawOptions);21 const {file, args, options} = handleArguments(rawFile, rawArgs, syncOptions);22 validateSyncOptions(options);23 const stdioStreamsGroups = handleInputSync(options, verboseInfo);24 return {file, args, command, escapedCommand, verboseInfo, options, stdioStreamsGroups};24 return {file, args, command, escapedCommand, startTime, verboseInfo, options, stdioStreamsGroups};25 } catch (error) {26 logEarlyResult(error, verboseInfo);26 logEarlyResult(error, startTime, verboseInfo);27 throw error;28 }29};30
4 unmodified lines
35 throw new TypeError('The "ipc: true" option cannot be used with synchronous methods.');36 }37};3839const spawnProcessSync = ({file, args, options, command, escapedCommand, stdioStreamsGroups}) => {39const spawnProcessSync = ({file, args, options, command, escapedCommand, stdioStreamsGroups, startTime}) => {40 let syncResult;41 try {42 syncResult = spawnSync(file, args, options);43 } catch (error) {44 return makeEarlyError({error, command, escapedCommand, stdioStreamsGroups, options});44 return makeEarlyError({error, command, escapedCommand, stdioStreamsGroups, options, startTime});45 }4647 pipeOutputSync(stdioStreamsGroups, syncResult);4849 const output = syncResult.output || Array.from({length: 3});50 const stdio = output.map(stdioOutput => handleOutput(options, stdioOutput));51 return getSyncResult(syncResult, {stdio, options, command, escapedCommand});51 return getSyncResult(syncResult, {stdio, options, command, escapedCommand, startTime});52};5354const getSyncResult = ({error, status, signal}, {stdio, options, command, escapedCommand}) => error !== undefined || isFailedExit(status, signal)54const getSyncResult = ({error, status, signal}, {stdio, options, command, escapedCommand, startTime}) => error !== undefined || isFailedExit(status, signal)55 ? makeError({56 error,57 command,58 escapedCommand,
2 unmodified lines
61 exitCode: status,62 signal,63 stdio,64 options,65 startTime,66 })66 : makeSuccessResult({command, escapedCommand, stdio, options});67 : makeSuccessResult({command, escapedCommand, stdio, options, startTime});
added:test/helpers/early-error.js+7 added
1import {execa, execaSync} from '../../index.js';23export const earlyErrorOptions = {killSignal: false};4export const getEarlyErrorProcess = options => execa('empty.js', {...earlyErrorOptions, ...options});5export const getEarlyErrorProcessSync = options => execaSync('empty.js', {...earlyErrorOptions, ...options});67export const expectedEarlyError = {code: 'ERR_INVALID_ARG_TYPE'};
modified:test/pipe/validate.js+2 added-1 removed
3 unmodified lines
4import test from 'ava';5import {execa} from '../../index.js';6import {setFixtureDir} from '../helpers/fixtures-dir.js';7import {foobarString} from '../helpers/input.js';8import {getEarlyErrorProcess} from '../helpers/early-error.js';910setFixtureDir();1112const assertPipeError = async (t, pipePromise, message) => {
188 unmodified lines
201202test('Sets the right error message when the "all" option is incompatible - early error', async t => {203 await assertPipeError(204 t,204 execa('empty.js', {killSignal: false})205 getEarlyErrorProcess()206 .pipe(execa('stdin.js', {all: false}))207 .pipe(execa('empty.js'), {from: 'all'}),208 '"all" option must be true',209 );
1 unmodified line
added:test/return/duration.js+62 added
1import test from 'ava';2import {execa, execaSync} from '../../index.js';3import {setFixtureDir} from '../helpers/fixtures-dir.js';4import {getEarlyErrorProcess, getEarlyErrorProcessSync} from '../helpers/early-error.js';56setFixtureDir();78const assertDurationMs = (t, durationMs) => {9 t.is(typeof durationMs, 'number');10 t.true(Number.isFinite(durationMs));11 t.false(Number.isInteger(durationMs));12 t.not(durationMs, 0);13 t.true(durationMs > 0);14};1516test('result.durationMs', async t => {17 const {durationMs} = await execa('empty.js');18 assertDurationMs(t, durationMs);19});2021test('result.durationMs - sync', t => {22 const {durationMs} = execaSync('empty.js');23 assertDurationMs(t, durationMs);24});2526test('error.durationMs', async t => {27 const {durationMs} = await t.throwsAsync(execa('fail.js'));28 assertDurationMs(t, durationMs);29});3031test('error.durationMs - sync', t => {32 const {durationMs} = t.throws(() => {33 execaSync('fail.js');34 });35 assertDurationMs(t, durationMs);36});3738test('error.durationMs - early validation', async t => {39 const {durationMs} = await t.throwsAsync(getEarlyErrorProcess());40 assertDurationMs(t, durationMs);41});4243test('error.durationMs - early validation, sync', t => {44 const {durationMs} = t.throws(getEarlyErrorProcessSync);45 assertDurationMs(t, durationMs);46});4748test('error.durationMs - unpipeSignal', async t => {49 const {durationMs} = await t.throwsAsync(execa('noop.js').pipe('stdin.js', {signal: AbortSignal.abort()}));50 assertDurationMs(t, durationMs);51});5253test('error.durationMs - pipe validation', async t => {54 const {durationMs} = await t.throwsAsync(execa('noop.js').pipe(false));55 assertDurationMs(t, durationMs);56});5758test.serial('result.durationMs is accurate', async t => {59 const minDurationMs = 1e3;60 const {durationMs} = await execa('delay.js', [minDurationMs]);61 t.true(durationMs >= minDurationMs);62});
modified:test/return/early-error.js+1 added-5 removed
1import process from 'node:process';2import test from 'ava';3import {execa, execaSync, $} from '../../index.js';4import {setFixtureDir} from '../helpers/fixtures-dir.js';5import {earlyErrorOptions, getEarlyErrorProcess, getEarlyErrorProcessSync, expectedEarlyError} from '../helpers/early-error.js';67setFixtureDir();89const isWindows = process.platform === 'win32';10const ENOENT_REGEXP = isWindows ? /failed with exit code 1/ : /spawn.* ENOENT/;1111const earlyErrorOptions = {killSignal: false};12const getEarlyErrorProcess = options => execa('empty.js', {...earlyErrorOptions, ...options});13const getEarlyErrorProcessSync = options => execaSync('empty.js', {...earlyErrorOptions, ...options});14const expectedEarlyError = {code: 'ERR_INVALID_ARG_TYPE'};1512test('execaSync() throws error if ENOENT', t => {13 t.throws(() => {14 execaSync('foo');15 }, {message: ENOENT_REGEXP});
75 unmodified lines
modified:test/return/error.js+2 added
13 unmodified lines
14 t.deepEqual(Reflect.ownKeys(result), [15 'command',16 'escapedCommand',17 'cwd',18 'durationMs',19 'failed',20 'timedOut',21 'isCanceled',22 'isTerminated',
15 unmodified lines
38 'originalMessage',39 'command',40 'escapedCommand',41 'cwd',42 'durationMs',43 'failed',44 'timedOut',45 'isCanceled',46 'isTerminated',
142 unmodified lines
modified:index.d.ts+18 added-10 removed
731 unmodified lines
732 */733 cwd: string;734735 /**736 Duration of the child process, in milliseconds.737 */738 durationMs: number;739740 /**741 Whether the process was canceled using the `cancelSignal` option.742 */743 isCanceled: boolean;744
257 unmodified lines
1002} catch (error) {1003 console.log(error);1004 /*1005 {1001 message: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',1006 message: 'Command failed with ENOENT: unknown command\nspawn unknown ENOENT',1007 errno: -2,1008 code: 'ENOENT',1009 syscall: 'spawn unknown',1010 path: 'unknown',1011 spawnargs: ['command'],1012 shortMessage: 'Command failed with ENOENT: unknown command\nspawn unknown ENOENT',1013 originalMessage: 'spawn unknown ENOENT',1008 shortMessage: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',1014 command: 'unknown command',1015 escapedCommand: 'unknown command',1011 stdout: '',1012 stderr: '',1016 cwd: '/path/to/cwd',1017 durationMs: 28.217566,1018 failed: true,1019 timedOut: false,1020 isCanceled: false,1021 isTerminated: false,1017 cwd: '/path/to/cwd'1022 stdout: '',1023 stderr: '',1024 stdio: [undefined, '', ''],1025 pipedFrom: []1026 }1027 \*\/1028}1029```
49 unmodified lines
1079} catch (error) {1080 console.log(error);1081 /*1082 {1075 message: 'Command failed with ENOENT: unknown command spawnSync unknown ENOENT',1083 message: 'Command failed with ENOENT: unknown command\nspawnSync unknown ENOENT',1084 errno: -2,1085 code: 'ENOENT',1086 syscall: 'spawnSync unknown',1087 path: 'unknown',1088 spawnargs: ['command'],1089 shortMessage: 'Command failed with ENOENT: unknown command\nspawnSync unknown ENOENT',1090 originalMessage: 'spawnSync unknown ENOENT',1082 shortMessage: 'Command failed with ENOENT: unknown command spawnSync unknown ENOENT',1091 command: 'unknown command',1092 escapedCommand: 'unknown command',1085 stdout: '',1086 stderr: '',1093 cwd: '/path/to/cwd',1094 failed: true,1095 timedOut: false,1096 isCanceled: false,1097 isTerminated: false,1091 cwd: '/path/to/cwd'1098 stdio: [],1099 pipedFrom: []1100 }1101 \*\/1102}1103```
290 unmodified lines
modified:index.test-d.ts+4 added
253 unmodified lines
254 expectType<boolean>(unicornsResult.isTerminated);255 expectType<string | undefined>(unicornsResult.signal);256 expectType<string | undefined>(unicornsResult.signalDescription);257 expectType<string>(unicornsResult.cwd);258 expectType<number>(unicornsResult.durationMs);259 expectType<ExecaReturnValue[]>(unicornsResult.pipedFrom);260261 expectType<undefined>(unicornsResult.stdio[0]);262 expectType<string>(unicornsResult.stdout);
304 unmodified lines
567 expectType<boolean>(execaError.isTerminated);568 expectType<string | undefined>(execaError.signal);569 expectType<string | undefined>(execaError.signalDescription);570 expectType<string>(execaError.cwd);571 expectType<number>(execaError.durationMs);572 expectType<string>(execaError.shortMessage);573 expectType<string | undefined>(execaError.originalMessage);574 expectType<ExecaReturnValue[]>(execaError.pipedFrom);575
140 unmodified lines
716 expectType<boolean>(unicornsResult.isTerminated);717 expectType<string | undefined>(unicornsResult.signal);718 expectType<string | undefined>(unicornsResult.signalDescription);719 expectType<string>(unicornsResult.cwd);720 expectType<number>(unicornsResult.durationMs);721 expectType<[]>(unicornsResult.pipedFrom);722723 expectType<undefined>(unicornsResult.stdio[0]);724 expectType<string>(unicornsResult.stdout);
62 unmodified lines
787 expectType<boolean>(execaError.isTerminated);788 expectType<string | undefined>(execaError.signal);789 expectType<string | undefined>(execaError.signalDescription);790 expectType<string>(execaError.cwd);791 expectType<number>(execaError.durationMs);792 expectType<string>(execaError.shortMessage);793 expectType<string | undefined>(execaError.originalMessage);794 expectType<[]>(execaError.pipedFrom);795
776 unmodified lines
modified:readme.md+15 added-5 removed
213 unmodified lines
214} catch (error) {215 console.log(error);216 /*217 {218 message: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',218 message: 'Command failed with ENOENT: unknown command\nspawn unknown ENOENT',219 errno: -2,220 code: 'ENOENT',221 syscall: 'spawn unknown',222 path: 'unknown',223 spawnargs: ['command'],224 shortMessage: 'Command failed with ENOENT: unknown command\nspawn unknown ENOENT',225 originalMessage: 'spawn unknown ENOENT',225 shortMessage: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',226 command: 'unknown command',227 escapedCommand: 'unknown command',228 stdout: '',229 stderr: '',228 cwd: '/path/to/cwd',229 durationMs: 28.217566,230 failed: true,231 timedOut: false,232 isCanceled: false,233 isTerminated: false233 isTerminated: false,234 stdout: '',235 stderr: '',236 stdio: [undefined, '', ''],237 pipedFrom: []238 }239 */240}241```
214 unmodified lines
456Type: `string`457458The [current directory](#cwd-1) in which the command was run.459460#### durationMs461462Type: `number`463464Duration of the child process, in milliseconds.465466#### stdout467468Type: `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`469
590 unmodified lines