fix: don't race the typechecker spawn grace period on windows#10814
Conversation
|
Hello @xevrion. Your PR has been labeled To keep your PR open, please follow these steps:
Please, do not generate or format the response with AI. If you do not speak English, reply in your native language or use translation software like Google Translate or Deepl. If the response is generated, the PR will be closed automatically. These measures help us reduce maintenance burden and keep the team's work efficient. See our AI contributions policy for more context. |
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
hi, i'm a human, ive used claude code to help with this one, i've reviewed the changes and i stand with it. |
|
Thanks! |
Description
On Windows a nonexistent typechecker command still spawns (the shell starts and then fails), so
Typechecker.spawncan't rely on theerrorevent. It currently waits 200ms for thecloseevent and otherwise declares the spawn successful. On a slow runner the shell takes longer than 200ms to fail, the timer wins, and instead ofSpawning typechecker failed - is typescript installed?the user gets an unhandledTypecheck Errorwith the shell's raw output. The same race makes thehandles non-existing typechecker command gracefullytest intest/typescriptflaky on Windows CI, most recently in this run.In run mode there is no need for a grace period at all:
startawaits the process right after spawning, so this change just waits forcloseand resolves or rejects based on the exit. That makes the error deterministic regardless of machine speed. Watch mode keeps the 200ms timer since the watch process never exits.The win32 code paths can't be exercised from my machine, so Windows CI on this PR is the verification for the changed behavior; the
test/typescriptsuite passes unchanged on Linux, which doesn't touch these branches.Refs #10618
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
handles non-existing typechecker command gracefullytest is the regression test - it fails intermittently on Windows without this change)pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.