Repository navigation
[scripts] Bug Fix: Fix Flow execution on Windows and propagate process failures - #10029
christdh213-droid wants to merge 1 commit into
Conversation
Addresses meta#10028 by executing the native flow-bin binary directly and handling startup failures and signal termination. Add process-level regression tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Thanks, this looks good. Running the binary that flow-bin exports is the right fix for the Windows spawn EINVAL. It matches how scripts/__tests__/unit/keyboardShortcutFlow.test.ts already runs Flow, and it keeps shell execution out of the picture.
Reproduced locally on Linux:
- The new tests pass (7/7).
pnpm run flowon this branch printsFound 0 errorsand exits 0.- The script exits 2 on a project with a deliberate type error.
The change also fixes a POSIX case the description doesn't mention. When Flow is killed by a signal, the old path through flow-bin's cli.js exits 0; this branch exits 1 with Flow was terminated by SIGKILL :(.
Optional, non-blocking:
- PR title: AGENTS.md ("Commits and Pull Requests") says "Test-only and tooling changes are
Chore", and the bracketed part names directories underpackages/. AChore:title fits that convention better than[scripts] Bug Fix:, and it can also be adjusted at merge. - Test plan: AGENTS.md asks for pasted Before/After output rather than a description. CI runs the scripts unit tests on Linux only, so pasting the vitest output behind your "6 failed, 1 skipped" and "6 passed, 1 skipped" Windows runs would make the Windows evidence self-contained.
No changeset is needed for a tooling-only change (AGENTS.md and the pull request template both say so).
Description
pnpm run flowfails on Windows withspawn EINVALbecausescripts/check-flow-types.mjsattempts to execute theflow.cmdshim without a shell. Node.js rejects this following the security hardening associated with CVE-2024-27980.This PR resolves the native executable exported by
flow-bindirectly, following an existing pattern inkeyboardShortcutFlow.test.ts, without introducing shell execution or additional dependencies.It also improves failure handling in the same execution path:
process.exitCodeto allow diagnostic output to drain.The existing arguments, working directory, environment and inherited stdio behavior are preserved.
Closes #10028.
Related: #9936.
Changeset
None required. This change affects repository development tooling only and does not modify published packages or public APIs.
Test plan
Before
On Windows 11 x64 with Node.js v24.19.0 and pnpm 11.24.0:
Exit code: 1.
Synchronous startup failures could also return exit code 0 under
--unhandled-rejections=warnornone.After
The real Flow check completes successfully:
Exit code: 0.
An isolated project containing a deliberate Flow type error correctly returned exit code 2.
Added seven process-level regression tests covering:
flow-binunder non-default unhandled-rejection configurations.Validation
Known limitations
--ignore-scripts; the standard installation and Husky hook workflow were not verified.AI assistance
Claude Code was used for implementation and validation. OpenAI Codex independently reviewed the implementation, identified failure-handling defects, and verified the subsequent corrections. The author personally reran the Flow check, targeted regression tests, formatting and script TypeScript checks.