Skip to content

Commit

Permalink
Prevent a throw when looking up undefined results
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Oct 21, 2024
1 parent 6bf46ca commit d928f9a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/run-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ module.exports = function runTask (task, options) {
// Attempt to figure out whether we're running via pnpm
const projectRoot = path.dirname(options.packageInfo.path)
const hasPnpmLockfile = fs.existsSync(path.join(projectRoot, 'pnpm-lock.yaml'))
const { status: pnpmFound, output: pnpmWhichOutput } = await which('pnpm', { nothrow: true })
const whichPnpmResults = await which('pnpm', { nothrow: true })
const pnpmFound = whichPnpmResults?.status
const pnpmWhichOutput = whichPnpmResults?.output
if (hasPnpmLockfile && __dirname.split(path.delimiter).includes('.pnpm') && pnpmFound) {
execPath = pnpmWhichOutput
}
Expand Down

0 comments on commit d928f9a

Please sign in to comment.