node
node copied to clipboard
inspector: introduce the `--inspect-wait` flag
This PR introduces the --inspect-wait
flag, which allows debugger to wait for attachement. This flag is useful when you want to debug the code from the beginning. Unlike --inspect-brk
, which breaks on the first line, this flag waits for debugger to be connected and then runs the code as soon as a session is established.
It's designed to simplify debugging by removing the need for manual intervention and providing a smoother debugging experience. With support for breaking on the first line and automatic process resumption, it streamlines the debugging process.
Other runtime works include:
- Deno https://docs.deno.com/runtime/manual/references/vscode_deno/#using-the-debugger
- Bun https://bun.sh/docs/runtime/debugger#inspect-wait
I'm not sure I understand the use case? Shouldn't this be solved from the consumer side that can call Debugger.resume
(or some such) after attaching with --inspect-brk
?
Shouldn't this be solved from the consumer side that can call Debugger.resume (or some such) after attaching with --inspect-brk?
Yes, the --inspect-wait
flag acts like a combination of --inspect-brk
and the client's Debugger.resume
call. It's designed to simplify debugging by removing the need for manual intervention and providing a smoother debugging experience. With support for breaking on the first line and automatic process resumption, I believe it streamlines the debugging process.
cc @nodejs/inspector
Please update https://github.com/nodejs/node/blob/main/doc/node.1 also.
@daeyeon Done
Failed to start CI
⚠ No approving reviews found ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/8908137018
CI: https://ci.nodejs.org/job/node-test-pull-request/58884/
CI: https://ci.nodejs.org/job/node-test-pull-request/58887/
CI: https://ci.nodejs.org/job/node-test-pull-request/58922/
@jasnell @daeyeon I've updated the Node.js debugger documentation to clarify the difference between the three flags. Please review it again and let me know if you have any better ideas. ba10f452ee96756b19000d847d6214603ae460ba
Failed to start CI
⚠ Something was pushed to the Pull Request branch since the last approving review. ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/8967104489
CI: https://ci.nodejs.org/job/node-test-pull-request/59034/
CI: https://ci.nodejs.org/job/node-test-pull-request/59071/
Landed in c0ae3b237364f5e6723cfa70784eafd55f466a7e
This PR adds a feature so it should be labeled https://github.com/nodejs/node/labels/semver-minor (this is not supposed to be done by releasers).
@targos Understood, I'll keep that in mind.
I'm not sure I understand the use case? Shouldn't this be solved from the consumer side that can call
Debugger.resume
(or some such) after attaching with--inspect-brk
?
NiM has had this feature since circa 2020 https://github.com/nodejs/node/issues/30911#issuecomment-602140349 so I find this amusing.