Skip to content
Myr

Rename `joinedCommand` variables to `command` (#278)

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

authored by ehmicky · committed by Sindre Sorhus · parent 7260fcf · Browse files · 1 file+10 added−10 removed
This commit

State

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

Diff stats

1 file+10 added−10 removed

  • other:+10 added−10 removed

1 file+10 added−10 removed

modified:index.js+10 added-10 removed
136 unmodified lines
137138function makeError(result, options) {139 const {stdout, stderr, signal} = result;140 let {error} = result;141 const {code, joinedCommand, timedOut, isCanceled, killed, parsed: {options: {timeout}}} = options;141 const {code, command, timedOut, isCanceled, killed, parsed: {options: {timeout}}} = options;142143 const [exitCodeName, exitCode] = getCode(result, code);144145 const prefix = getErrorPrefix({timedOut, timeout, signal, exitCodeName, exitCode, isCanceled});146 const message = `Command ${prefix}: ${joinedCommand}`;146 const message = `Command ${prefix}: ${command}`;147148 if (error instanceof Error) {149 error.message = `${message}\n${error.message}`;150 } else {151 error = new Error(message);152 }153154 error.command = joinedCommand;154 error.command = command;155 delete error.code;156 error.exitCode = exitCode;157 error.exitCodeName = exitCodeName;158 error.stdout = stdout;
81 unmodified lines
240241const execa = (file, args, options) => {242 const parsed = handleArgs(file, args, options);243 const {encoding, buffer, maxBuffer} = parsed.options;244 const joinedCommand = joinCommand(file, args);244 const command = joinCommand(file, args);245246 let spawned;247 try {248 spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);249 } catch (error) {250 return Promise.reject(makeError({error, stdout: '', stderr: '', all: ''}, {251 joinedCommand,251 command,252 parsed,253 timedOut: false,254 isCanceled: false,255 killed: false
93 unmodified lines
349350 if (result.error || result.code !== 0 || result.signal !== null) {351 const error = makeError(result, {352 code: result.code,353 joinedCommand,353 command,354 parsed,355 timedOut,356 isCanceled,357 killed: spawned.killed
6 unmodified lines
364 throw error;365 }366367 return {368 command: joinedCommand,368 command,369 exitCode: 0,370 exitCodeName: 'SUCCESS',371 stdout: result.stdout,372 stderr: result.stderr,
35 unmodified lines
408module.exports = execa;409410module.exports.sync = (file, args, options) => {411 const parsed = handleArgs(file, args, options);412 const joinedCommand = joinCommand(file, args);412 const command = joinCommand(file, args);413414 if (isStream(parsed.options.input)) {415 throw new TypeError('The `input` option cannot be a stream in sync mode');416 }
4 unmodified lines
421422 if (result.error || result.status !== 0 || result.signal !== null) {423 const error = makeError(result, {424 code: result.status,425 joinedCommand,425 command,426 parsed,427 timedOut: result.error && result.error.errno === 'ETIMEDOUT',428 isCanceled: false,429 killed: result.signal !== null
6 unmodified lines
436 throw error;437 }438439 return {440 command: joinedCommand,440 command,441 exitCode: 0,442 exitCodeName: 'SUCCESS',443 stdout: result.stdout,444 stderr: result.stderr,
38 unmodified lines