fix: don't fail with scriptShell set to false (#10023)

close #8748

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
Alexey Khachaturyan
2025-09-28 15:37:46 +05:00
committed by GitHub
parent 0e58f873d9
commit a514bc0997
2 changed files with 7 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/lifecycle": patch
"pnpm": patch
---
Don't fail with a meaningless error when `scriptShell` is set to `false` [#8748](https://github.com/pnpm/pnpm/issues/8748).

View File

@@ -59,7 +59,7 @@ export async function runLifecycleHook (
//
// Note that npm (as of version 10.5.0) doesn't support setting script-shell
// to a .bat or .cmd file either.
if (opts.scriptShell != null && isWindowsBatchFile(opts.scriptShell)) {
if (opts.scriptShell != null && typeof opts.scriptShell === 'string' && isWindowsBatchFile(opts.scriptShell)) {
throw new PnpmError('ERR_PNPM_INVALID_SCRIPT_SHELL_WINDOWS', 'Cannot spawn .bat or .cmd as a script shell.', {
hint: `\
The pnpm-workspace.yaml scriptShell option was configured to a .bat or .cmd file. These cannot be used as a script shell reliably.