Skip to content

Commit

Permalink
Fix shell
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Aug 25, 2019
1 parent dc55446 commit f05e386
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/run/runners/cli/benchmark/spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export const spawnProcess = async function(
command,
{ variation, shell, stdio },
) {
const shellA = String(shell) === 'true'
const execaFunc = shellA ? execa : execa.command
await execaFunc(command, { stdio, shell: shellA, preferLocal: true })
const execaFunc = shell ? execa : execa.command
await execaFunc(command, { stdio, shell, preferLocal: true })
}
16 changes: 13 additions & 3 deletions src/run/runners/cli/load/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ export const normalizeTasks = function({
const tasksA = Object.entries(tasks).map(([taskId, task]) =>
normalizeTask({ taskId, task, taskPath, variables }),
)
const shellA = applyTemplate(shell, variables)
const shellA = getShell({ shell, variables })
return { tasks: tasksA, variations, shell: shellA }
}

const DEFAULT_SHELL = true

const normalizeTask = function({
taskId,
task: { title, variations, main, before, after },
Expand All @@ -42,3 +40,15 @@ const applyTaskTemplates = function({ title, variations, variables }) {
)
return { taskTitle, variationsIds }
}

// `shell` can contain variables, i.e. can be a string 'true' or 'false'
const getShell = function({ shell = DEFAULT_SHELL, variables }) {
if (typeof shell === 'boolean') {
return shell
}

const shellA = applyTemplate(shell, variables)
return shellA === 'true'
}

const DEFAULT_SHELL = true

0 comments on commit f05e386

Please sign in to comment.