From d928f9ad59c00a20797c90d35b62ef0aecf0c364 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Mon, 21 Oct 2024 14:48:57 -0700 Subject: [PATCH] Prevent a throw when looking up undefined results --- lib/run-task.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/run-task.js b/lib/run-task.js index e30bb83..002b787 100644 --- a/lib/run-task.js +++ b/lib/run-task.js @@ -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 }