Skip to content

fix(test): avoid powershell flake by spawning absolute-path cmd.exe (closes #95)#96

Merged
zackees merged 1 commit intomainfrom
fix/95-test-process-command-cmd-exe
Apr 18, 2026
Merged

fix(test): avoid powershell flake by spawning absolute-path cmd.exe (closes #95)#96
zackees merged 1 commit intomainfrom
fix/95-test-process-command-cmd-exe

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented Apr 18, 2026

Summary

  • test_process_command on Windows was spawning powershell by basename, relying on SearchPathW resolution during Command::spawn. Under concurrent workspace test load that occasionally failed with ERROR_FILE_NOT_FOUND (surfaced as "failed to launch QEMU at powershell: program not found").
  • Switch to %SystemRoot%\System32\cmd.exe with an absolute path and cmd /C "echo line1& echo line2". echo is a cmd built-in so there is no nested executable lookup, and the absolute path bypasses PATH races entirely.
  • Matches the request to reduce dependence on PowerShell across the test harness where cmd-level functionality suffices.

Test plan

  • uv run cargo test -p fbuild-daemon --lib handlers::emulator run 5× consecutively — 0 flakes.
  • Per-run wall-clock dropped from ~0.54 s to ~0.16 s.
  • uv run cargo clippy --workspace --all-targets -- -D warnings clean.
  • Full uv run cargo test --workspace — the specific regression (run_avr8js_headless_captures_stdout) is gone. (An unrelated flake in toolchain::esp_qemu::hydrate_windows_runtime_copies_iconv_next_to_exe was observed once under the same concurrent load and passes in isolation — tracked separately; same root cause class as perf(build): investigate warm-pass compilation stall — 30s where cache says <1s #91.)

Related

…loses #95)

test_process_command previously spawned "powershell" by basename, relying
on SearchPathW to resolve it. Under concurrent test load that resolution
occasionally failed with ERROR_FILE_NOT_FOUND, producing flakes like
"failed to launch QEMU at powershell: program not found".

Switch to cmd.exe via %SystemRoot%\System32\cmd.exe — always present at a
known absolute path, no PATH race, and echo is a cmd built-in so there is
no nested executable lookup. Net: the 5-run stress loop is now flake-free
and per-run wall-clock dropped from ~0.54s to ~0.16s (no powershell spawn).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

Warning

Rate limit exceeded

@zackees has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 24 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 14 minutes and 24 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 55d1173e-e864-442c-82cc-d08dbd725c41

📥 Commits

Reviewing files that changed from the base of the PR and between 288962b and aeb0575.

📒 Files selected for processing (1)
  • crates/fbuild-daemon/src/handlers/emulator.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/95-test-process-command-cmd-exe

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

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

@zackees zackees merged commit a9dbc00 into main Apr 18, 2026
75 of 77 checks passed
@zackees zackees deleted the fix/95-test-process-command-cmd-exe branch April 18, 2026 15:58
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.

flake(test): Windows emulator tests spawn 'powershell' by basename, fail under concurrent load

1 participant