Skip to content

fix: avoid deprecated shell spawning for pnpm commands - #52

Merged
zkochan merged 2 commits into
pnpm:mainfrom
sebdanielsson:copilot/fix-deprecation-warning
Sep 20, 2026
Merged

zkochan merged 2 commits into
pnpm:mainfrom
sebdanielsson:copilot/fix-deprecation-warning

Conversation

@sebdanielsson

@sebdanielsson sebdanielsson commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #18.

Automatic installs and post-job store pruning emitted Node's DEP0190 warning because they passed arguments with shell: true.

Installs now invoke the action's downloaded native pnpm / pnpm.exe directly. The destination is resolved to an absolute path so relative dest values keep working when the project is in a different working directory.

Pruning uses @actions/exec to preserve PATH precedence, including the shim created by a later pnpm self-update, and to support Windows .cmd shims without the deprecated spawn options. The post action awaits pruning before saving the cache; pruning errors remain warnings.

Validation:

  • 43 local tests pass, including real process execution with spaces and shell metacharacters in the destination, self-update shim precedence, skipped pruning, and nonfatal pruning errors.
  • TypeScript check and bundle build pass.
  • New Linux/Windows command-execution CI runs with --throw-deprecation.

Copilot AI lite review requested due to automatic review settings September 4, 2026 20:52
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: c5161b3c-763d-4751-84f4-2154570d0b4a

📥 Commits

Reviewing files that changed from the base of the PR and between 703c526 and 8dd17f0.

⛔ Files ignored due to path filters (1)
  • dist/index.js is excluded by !**/dist/**
📒 Files selected for processing (3)
  • src/inputs/index.ts
  • src/pnpm-install/index.ts
  • src/pnpm-store-prune/index.ts

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Greptile Review
🔇 Additional comments (3)
src/inputs/index.ts (1)

129-129: LGTM!

src/pnpm-install/index.ts (1)

51-53: LGTM!

src/pnpm-store-prune/index.ts (1)

3-3: LGTM!

Also applies to: 13-14


📝 Walkthrough

Walkthrough

The action now resolves dest to an absolute path. Pnpm install and store-prune operations invoke the platform-specific pnpm executable from that path without using shell-based PATH resolution.

Changes

Direct pnpm execution

Layer / File(s) Summary
Destination path resolution
src/inputs/index.ts
The dest input expands tilde notation and resolves to an absolute path.
Platform-specific executable invocation
src/pnpm-install/index.ts, src/pnpm-store-prune/index.ts
Both operations invoke pnpm from inputs.dest, using pnpm.exe on Windows and pnpm elsewhere. Shell execution is removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: zkochan

Merge Risk: ⚪ Minimal · up to 8dd17

The action now runs the installed pnpm executable from an absolute destination path, avoiding shell spawning and the associated deprecation warning. No current merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: pnpm commands no longer use deprecated shell-based spawning.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit found a path made bright
With absolute steps in moonlit light
Pnpm hopped from its own front door
No shell was needed anymore
Windows ears heard .exe right

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are small, consistent across call sites, and correctly avoid shell: true by executing the installed pnpm binary via a stable absolute path.

Pull request overview

This pull request removes shell: true from pnpm invocations (addressing Node’s DEP0190 warning) by executing the pnpm binary via an absolute path derived from the action’s configured dest directory.

Changes:

  • Spawn pnpm via path.join(inputs.dest, 'pnpm(.exe)') instead of relying on shell: true + PATH resolution.
  • Normalize dest to an absolute path in getInputs() so spawning remains correct regardless of cwd.
  • Apply the same approach to both pnpm install and pnpm store prune.
File summaries
File Description
src/pnpm-store-prune/index.ts Runs pnpm store prune by absolute executable path and drops shell: true.
src/pnpm-install/index.ts Runs pnpm install by absolute executable path and drops shell: true.
src/inputs/index.ts Resolves dest to an absolute path to keep spawned executable paths stable.
Review details
  • Files reviewed: 3/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

The command-execution changes appear behaviorally safe, but the repository’s explicit rule against narrating comments must be satisfied before merging.

Reviews (2) · Last reviewed commit: "fix: preserve updated pnpm when pruning ..."

Comment thread src/pnpm-store-prune/index.ts Outdated
@sebdanielsson

Copy link
Copy Markdown
Contributor Author

@zkochan hi! Sorry for pinging, just wanted to check in if you've seen this and if the changes look sound.

Copilot AI and others added 2 commits September 20, 2026 22:45
…arning

pnpm install and pnpm store prune were spawned with an args array and
`shell: true`, which makes Node emit a DEP0190 deprecation warning
("Passing args to a child process with shell option true can lead to
security vulnerabilities") on every run.

Spawn the pnpm this action installed by its absolute path instead —
path.join(dest, 'pnpm.exe' | 'pnpm'). Running the .exe directly on Windows
runs the actual binary rather than the .cmd batch file, which needs no
shell, so the warning is gone on every platform. `dest` is normalized to
an absolute path in getInputs so the spawned path is not affected by the
`cwd` the install runs with.

Co-authored-by: sebdanielsson <20663065+sebdanielsson@users.noreply.github.com>
@zkochan zkochan changed the title fix: spawn pnpm without a shell to silence Node DEP0190 deprecation w… fix: avoid deprecated shell spawning for pnpm commands Sep 20, 2026
@zkochan
zkochan force-pushed the copilot/fix-deprecation-warning branch from 8dd17f0 to 0b7e77a Compare September 20, 2026 20:47
@zkochan
zkochan merged commit 463911b into pnpm:main Sep 20, 2026
44 checks passed
Comment on lines +37 to +40

// A native executable named pnpm proves direct spawning works even when the
// destination contains spaces or shell metacharacters. Node consumes the
// fixture named "install" as its script, then passes through the install flags.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Narrating comments violate policy

This comment restates how the native executable fixture and its arguments work instead of letting the test structure express that intent. The same pattern appears in the PATH setup at line 84 and in src/pnpm-store-prune/index.ts at lines 13–15. This violates the repository directive that comments must not narrate code, so the narration must be removed or the surrounding names and structure made self-explanatory before merging.

Context Used: Comments and docs in code are suspicious. Is test coverage not sufficient the reason why a comment was added? Comments should not replace tests. Comments should also not narrate code. Is the code hard to understand? Then it should be refactored to ma... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm/setup prints deprecation warnings with Node.js 24 on GitHub actions

4 participants