mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 13:51:47 +00:00
fix: address coderabbit review - clarify pre-attach guard, fix hardcoded port
Improve the comment on the pre-attach debugger guard to explain why it only fires on the SIGUSR1 path (--inspect already has the debugger attached by JSC at startup). Replace hardcoded port 6499 assertion in Windows test with regex match. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -136,6 +136,10 @@ public:
|
||||
// StopTheWorld (JSC's JSON parser needs GC heap operations that conflict with STW).
|
||||
// By attaching early, we enable the pause mechanism so messages can be
|
||||
// dispatched in the normal runWhilePaused loop after STW completes.
|
||||
// Pre-attach the debugger so that notifyNeedDebuggerBreak() can trigger a pause
|
||||
// for CDP message dispatch. This only fires on the SIGUSR1 path because --inspect
|
||||
// and --inspect-wait already have the debugger attached by JSC at startup
|
||||
// (globalObject->debugger() is non-null), so the condition is false for those paths.
|
||||
auto* controllerDebugger = globalObject->inspectorController().debugger();
|
||||
if (controllerDebugger && !globalObject->debugger()) {
|
||||
controllerDebugger->attach(globalObject);
|
||||
|
||||
@@ -93,7 +93,7 @@ describe.skipIf(!isWindows)("Runtime inspector Windows file mapping", () => {
|
||||
|
||||
// Verify inspector actually started
|
||||
expect(targetStderr).toContain("Bun Inspector");
|
||||
expect(targetStderr).toContain("ws://localhost:6499/");
|
||||
expect(targetStderr).toMatch(/ws:\/\/localhost:\d+\//);
|
||||
});
|
||||
|
||||
test("_debugProcess works with current process's own pid", async () => {
|
||||
|
||||
Reference in New Issue
Block a user