Skip to content

Commit

Permalink
Improve validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Feb 6, 2022
1 parent 30edf36 commit 1c29532
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/runners/cli/handler/measure.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { execa, execaCommand } from 'execa'
import now from 'precise-now'

import { wrapError } from '../../../error/wrap.js'
import { TasksRunError } from '../../common/error.js'

// `beforeAll` and `afterAll`
export const before = async function ({ task: { beforeAll }, env, shell }) {
await performHook(beforeAll, { env, shell })
Expand Down Expand Up @@ -80,11 +83,13 @@ const spawnProcesses = async function (command, { repeat, env, shell }) {
// - Using shell features (subshells, variables, etc.)
// - Adding the logic to the command internal logic
const spawnProcess = async function (command, { env, shell }) {
if (shell === 'none') {
return await execaCommand(command, { ...EXECA_OPTIONS, env })
try {
return shell === 'none'
? await execaCommand(command, { ...EXECA_OPTIONS, env })
: await execa(command, { ...EXECA_OPTIONS, env, shell })
} catch (error) {
throw wrapError(error, '', TasksRunError)
}

await execa(command, { ...EXECA_OPTIONS, env, shell })
}

const EXECA_OPTIONS = {
Expand Down

0 comments on commit 1c29532

Please sign in to comment.