Skip to content

Commit

Permalink
Fix new Execa version
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Dec 22, 2019
1 parent f160341 commit cac7630
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
14 changes: 8 additions & 6 deletions src/processes/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getTimeoutError } from './timeout.js'

// Forward any child process error
export const forwardChildError = function({
message,
shortMessage,
failed,
timedOut,
duration,
Expand All @@ -16,7 +16,7 @@ export const forwardChildError = function({
}

const messageA = getMessage({
message,
shortMessage,
timedOut,
duration,
taskPath,
Expand All @@ -28,7 +28,7 @@ export const forwardChildError = function({
}

const getMessage = function({
message,
shortMessage,
timedOut,
duration,
taskPath,
Expand All @@ -43,7 +43,7 @@ const getMessage = function({
return `${taskPrefix}${timeoutError}`
}

const execaError = getExecaError(message)
const execaError = getExecaError(shortMessage)
const errorOutputA = normalizeErrorOutput(errorOutput)
return `${taskPrefix}${execaError}${errorOutputA}`
}
Expand All @@ -61,8 +61,10 @@ const getTaskPrefix = function({ taskPath, taskId, variationId }) {
return `In '${taskPath}', task '${taskId}' (variation '${variationId}'): `
}

const getExecaError = function(message) {
return message.replace(EXECA_MESSAGE_START, '').replace(EXECA_MESSAGE_END, '')
const getExecaError = function(shortMessage) {
return shortMessage
.replace(EXECA_MESSAGE_START, '')
.replace(EXECA_MESSAGE_END, '')
}

const EXECA_MESSAGE_START = 'Command '
Expand Down
4 changes: 2 additions & 2 deletions src/processes/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const executeChild = async function({
// Wait for child process successful exit, failed exit, spawning error,
// stream error or timeout
const [
{ message, failed, timedOut },
{ shortMessage, failed, timedOut },
output,
errorOutput,
] = await Promise.all([
Expand All @@ -49,7 +49,7 @@ export const executeChild = async function({
])

forwardChildError({
message,
shortMessage,
failed,
timedOut,
duration,
Expand Down
4 changes: 3 additions & 1 deletion src/run/description.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const getVersion = async function({ name, value, runnerId }) {
const version = stdout.replace(LEADING_V, '')
return `${nameA}${version}`
} catch (error) {
throw new Error(`Could not load runner '${runnerId}'\n\n${error.message}`)
throw new Error(
`Could not load runner '${runnerId}'\n\n${error.shortMessage}`,
)
}
}

Expand Down

0 comments on commit cac7630

Please sign in to comment.