Skip to content

fix(cli): launch Windows package-manager shims through the spawn adapter - #250

Merged
AmanVarshney01 merged 2 commits into
mainfrom
codex/verify-windows-cli
Sep 10, 2026
Merged

AmanVarshney01 merged 2 commits into
mainfrom
codex/verify-windows-cli

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Problem

The consolidated CLI delegates Composer and other commands through its own spawn adapter. That adapter used native node:child_process.spawn, which cannot execute Windows .cmd shims directly.

Reproduced

The first commit runs the real installed npm.cmd through the shipped adapter. Existing Windows CI failed with spawn EINVAL (-4071), while 951 other tests passed: https://github.com/prisma/prisma-cli/actions/runs/34236425789/job/102095202659.

Fix

Use cross-spawn at the owning adapter. Preserve argv arrays, inherited human stdio, structured diagnostic forwarding/backpressure, bounded drain, exit status, and signal forwarding. No blanket shell:true and no create-prisma workaround. Declare the runtime dependency in both published package manifests. Document the execution contract.

Verification

Scope

Fixes Windows delegated shim launch failures, not every CLI.SPAWN_FAILED, auth error, build failure, or install failure. Composer executable discovery is separate: prisma/composer#280.

Ready for review. All CI checks passed, including the native Windows regression.

Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Essentials

Run ID: 34f8c0ed-f828-4ac7-a810-7c36e008f516

📥 Commits

Reviewing files that changed from the base of the PR and between 27b6835 and 4d84212.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • docs/product/output-conventions.md
  • packages/cli/package.json
  • packages/cli/src/spawn.ts
  • packages/cli/tests/spawn-adapter.test.ts
  • packages/prisma/package.json

Included review availability: 2 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.


Summary by CodeRabbit

  • New Features

    • Delegated commands now support Windows .cmd shims, native executables, and POSIX shebang scripts.
    • Cross-platform command and argument handling is supported while preserving existing output and exit-status behavior.
  • Tests

    • Added Windows coverage for running installed command-line shims and validating successful completion and diagnostic output.
  • Documentation

    • Updated command execution guidance to describe cross-platform support.

Walkthrough

The CLI spawn adapter now uses cross-spawn. The CLI and Prisma packages declare the required runtime dependencies, and the CLI declares type support. Product conventions document support for Windows .cmd shims, native executables, and POSIX shebang scripts. Tests wrap cross-spawn and verify Windows execution of npm.cmd, exit code 0, and version-formatted diagnostic output.

Merge Risk: ⚪ Minimal · up to 4d842

Delegated CLI commands now support Windows .cmd shims while retaining argument-array execution and existing output behavior. No merge-blocking risk remains.

🚥 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 1 functions across 2 files. (3 skipped: 3 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: enabling the CLI spawn adapter to launch Windows package-manager shims.
Description check ✅ Passed The description directly explains the Windows shim failure, the cross-spawn fix, preserved behavior, scope, and verification results.
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.
Full details: Docstring Coverage

Explanation

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 1 functions across 2 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/verify-windows-cli
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/verify-windows-cli

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

@pkg-pr-new

pkg-pr-new Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npx https://pkg.pr.new/@prisma/cli@250
npx https://pkg.pr.new/@prisma/cli-engine@250

commit: 4d84212

Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
@AmanVarshney01
AmanVarshney01 marked this pull request as ready for review September 10, 2026 07:48
@AmanVarshney01
AmanVarshney01 merged commit 6c29b84 into main Sep 10, 2026
15 checks passed
@AmanVarshney01
AmanVarshney01 deleted the codex/verify-windows-cli branch September 10, 2026 09:49
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.

2 participants