-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow repl pause on exception state to be set from env #48425
base: main
Are you sure you want to change the base?
feat: allow repl pause on exception state to be set from env #48425
Conversation
+1 thanks! |
I know there's usually resistance to adding environment variables even moreso than CLI flags, but I'm not sure there's a better route to enable this feature.... @nodejs/post-mortem (Is that even the right group to ping for the CLI debugger?) |
We would want the env variable to be documented along side the other env variables Node.js supports. |
True. The OP acknowledged that:
Maybe this should be in draft mode. Anyway, I'm trying to remember who has expressed something at least vaguely like "please, no more environment variables" opinions in the past. Maybe it was @cjihrig? |
I don't think it was me - at least not originally. IIRC, the agreed upon way to move forward recently has been adding CLI flags and passing those via the |
Since you can always set flags via the If the new option applies only to |
While that might present challenges for the And on the other hand, there already is the Since this is for a developer CLI convenience, I think we'd want something that they could set once and never have to think about again. That implies an environment variable, and it also implies one that isn't Or on the other hand, as Geoffrey points out, it could just be a flag and developers could set up a shell alias or whatever. I should probably collect my thoughts and come up with a recommendation rather than all this listing out of pros and cons..... |
To counter-argue: that was introduced when node-inspect was moved into core, i.e., a third-party indiscretion. FWIW, I was probably the one who first pushed back against adding yet more environment variables. They're essentially ambient state and that's something to avoid as much as possible. |
Works for me. I'm happy to be on board with "use CLI flags and set them in Honestly, if we were designing this particularly thing (CLI debugging settings) from scratch, I wonder if the approach we'd want is to read some kind of config file. |
The other idea I had was using something like {
"pauseOnException": "uncaught"
"port": 0,
"inspectResumeOnStart": true
} The interesting thing about the javascript model here is you could add a configuration hook to do all sorts of customization (like python, ruby, etc) have: module.exports = function(repl, debugger, etc) {
repl.shortcuts.push(...)
}
Yes, definitely!
I'm with this approach, and maybe we could add a Needing to have a ton of options passed to the CLI right now degrades the UX of In summary, it sounds like what is being proposed is:
I would first submit a PR to refactor the argument parser, and then update this PR to use What I'd like to propose is in addition to the above is:
What do folks think? |
I like the first one. I think ideally, we would add support for Re |
Right now, it's not possible to configure the debugger to pause on uncaught exceptions without manually configuring the pause state on each run. This change would allow the pause state to be configured via a shell env variable to allow for faster CLI-based node debugging.
6144954
to
836df08
Compare
Update here for @GeoffreyBooth, @Trott, and team!
This is working great on my
Wanted to post here and get some initial feedback on the approach before I go farther. |
Existing tests for the CLI debugger are in The helper library for CLI debugger tests is documented in For non-debugger-specific stuff about tests, there is a guide in You can also ask questions about writing tests for Node.js core in the |
Oh, it appears that there are also a small number of them in |
Right now, it's not possible to configure the debugger to pause on uncaught exceptions
without manually configuring the pause state on each run. This change would allow the
pause state to be configured via a shell env variable to allow for faster CLI-based node
debugging.
I'm not sure if there's a reason there aren't more configuration options for
node inspect
,so I wanted to submit this PR for discussion before writing tests and updating documentation.