-
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
WIP: src,inspector: add --inspect-silent option #12671
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely a fan of this.
What's the difference between this and sending a |
Also, I'd personally prefer |
A flag can automatically be a boolean, but also allows specifying the port and host. Is that currently an option with an env. variable? |
Introducing a new cli option |
If you want to turn off the hint, we're going to have to add something new, unless there is already an existing solution. If it is only an environment variable, then you're either going to have to do version detection or continue assuming that the hint output is present. It's also worth noting that the inspector is still an experimental feature and subject to change. It should stabilize with Node 8. Additionally, in Node 8 there will be no "prefer inspector protocol" since the old debugger is going away. |
@cjihrig An environment variable could be boolean and the port and host will still be specified as previously. |
The "bad option" point is correct - although if you're already doing version detection it's a very simple workaround. The flag in this PR can already be used as a Boolean. If your goal is to be able to silence the hint in your tool, you're still going to have to do version detection though, unless you always assume the hint is there. |
How about a more general |
Re: version detection / protocol selection. IMHO it's a solved problem for all major tools. |
[bikeshed] why not |
@cjihrig ... just a random thought... if the inspector hint were emitted via the process.emitWarning() mechanism instead, then the existing mechanisms for suppressing warning output would work for this also. |
@jasnell that's not a bad idea. The inspector hint isn't really a warning though. I foresee people showing up that want one or the other (warnings and no hint, or more likely, hint and no warnings). |
I've been stewing over the idea of allowing |
@jasnell was about to post similar. We don't need a new env var (because I'm also think its just fine saying "the inspector hint is a warning that the inspector is running" and treating it like a warning because it is. That works pretty well with warning categories as you suggest. Also allows deprecations to be unified with warnings, perhaps? |
A Deprecations are already unified with warnings. They use |
@cjihrig I stand corrected - a new flag won't make tools more critically dependent on node version detection, because if version detection fails (unlucky case), a tool just won't suppress hint text which is not a big problem.
It makes impossible for a tool to debug multi-process node apps, because the tool won't be notified that a child process's debugger is ready for attaching. |
@segrey ... if the debugger hints are evolved to use |
@jasnell Yeah, but not sure that Java can listen for |
@segrey ... no, but a preload module can be used to hook into those events to provide custom handling. |
@jasnell Will master process receive warnings from child processes? It doesn't happen in 7.9.0. Not sure, but a preload module seems like a complication to hide inspect hint text. Probably, it'd be easier/safer to continue analyzing stderr and update the logic on hint text change... Sorry for the noise. |
No, but it can be made to forward those. Another recently added option is --redirect-warnings which allows sending all warnings to a file rather than to stderr. |
@jasnell Seems forwarding warnings to |
Allow the inspector to be used without printing anything to the console. This is useful when working with tools that know how to use the inspector.
If this is OK, I'll add the tests and docs.
Fixes: #12665
R= @eugeneo
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)