fix(openInEditor): disable spawnSync signal forwarding for editor helper - #31195
fix(openInEditor): disable spawnSync signal forwarding for editor helper#31195fallintoplace wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis PR adds a ChangesSignal forwarding gate for sync spawn
Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/js/bun/util/open-in-editor-gc.test.ts`:
- Around line 68-71: The helper script exits immediately because the final line
uses exec ${shellQuote(sleepPath)} "$1" where $1 is a temp-file path
(non-numeric), so sleep returns and the fake editor dies right after printing
ready; update the script template in open-in-editor-gc.test.ts to keep the fake
editor alive after printing ready by exec'ing sleep with a long numeric duration
(e.g., exec ${shellQuote(sleepPath)} 9999999) or another blocking command,
ensuring references to sleepPath and ready in the template are preserved.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: ba9017af-5776-48a0-9e24-a72c0196cbdc
📒 Files selected for processing (3)
src/runtime/cli/open.rssrc/spawn/process.rstest/js/bun/util/open-in-editor-gc.test.ts
661705d to
f91f9cb
Compare
|
Thanks for the report and the fix, and for the test scenario. I consolidated the three open fixes for #31194 into #31297. It takes a slightly different route: instead of adding a forward_signals option to the sync spawn options, the editor thread stops using the spawnSync machinery altogether and goes through bun_core::spawn_sync_inherit (plain spawn and wait, which is what the pre-Rust implementation did). That keeps the forwarding code with exactly one caller, and as a side effect also fixes the PATH lookup of the xdg-open opener and the per-open event loop allocation on Windows. This branch had also picked up a conflict in src/spawn/process.rs in the meantime. Your SIGUSR2 listener scenario is in #31297 as the "process.on signal handler still runs while an editor is up" test, with a Co-authored-by credit to you on that commit. Closing this one in favor of #31297. |
What changed
forward_signalsoption to sync spawn options, defaulting totrue.Bun.openInEditor()editor helper spawn.SIGUSR2handler still runs while the editor helper is waiting.Why
Bun.openInEditor()usessync::spawn()only as a blocking implementation detail inside a detached helper thread. It should not install the foregroundbun run/bunxsignal-forwarding handlers process-wide while user JS continues running.Fixes #31194
Testing
git diff --checkcargo fmt --all --checknpx --yes prettier@3.6.2 --check --config .prettierrc test/js/bun/util/open-in-editor-gc.test.tsNot run locally:
bun bd test test/js/bun/util/open-in-editor-gc.test.tsbecause nobunbinary is installed in this checkout.cargo check -p bun_spawn --keep-goingbecause this plain checkout does not have the generated/fetchedvendor/lolhtml/c-apipath dependency.