Files
pnpm/.changeset/script-shell-for-lifecycle-scripts.md
T
Zoltan Kochan 1dbc1963cc fix(package-manager): honor scriptShell for lifecycle scripts (#13453)
`scriptShell` reached only `pnpm run` / `pnpm exec` (and `pnpm version`).
Every lifecycle script the install spawns passed `script_shell: None` and
so ran under the platform default, `sh` or `cmd`, however the workspace
had configured its shell. The TypeScript CLI threads `scriptShell` into
the same runs through `scriptsOpts`, so a workspace whose scripts assume
its configured shell worked there and not here.

Thread `config.script_shell` to the three contexts that spawn scripts
during an install: dependency build scripts, a project's own lifecycle
scripts, and `pnpm:devPreinstall`.

Deliberately unchanged, because the TypeScript CLI does not pass
`scriptShell` there either and matching it is the point:

- git-hosted dependency preparation (`install_package_by_snapshot`,
  `patch`), whose counterpart `exec/prepare-package` builds its
  `RunLifecycleHookOptions` without the field.
- `pack` and `publish` lifecycle scripts, likewise.

The tests spawn through a shell shim that records each script it is
handed, so a context that ignores the setting fails rather than silently
falling back to the default shell. Unix-only: the probe is a shell
script, and `select_shell` rejects `.cmd` / `.bat` shims on Windows.
2026-07-28 01:27:49 +02:00

6 lines
386 B
Markdown

---
"pacquet": patch
---
`scriptShell` now selects the shell for lifecycle scripts too — dependency build scripts and a project's own `preinstall`/`install`/`postinstall`/`prepare` and `pnpm:devPreinstall` — not only for `pnpm run` and `pnpm exec`. A workspace that configures a shell was still getting the platform default (`sh` / `cmd`) for everything the install itself spawns.