-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
enhancement: provide list of allowed flags of current executable #17740
Comments
Why is that user-hostile? I ask because...
...we can't list V8 flags (node.js doesn't know them) and that makes There's also the question of how (or if) it should interact with the
Yes, although not recently, I think. |
You are entitled to your opinion, but this will reduce the number of PRs we have to merge to support new flags to 0.
Simply because we can't list them. Since Node.js can't list the v8 flags either, it's not an expectation. |
I most certainly am and that argument doesn't sway me because it means the PRs we have to merge becomes > 0. :-)
I don't understand why that is important. |
Are you serious? |
Yes. Stick to substantial comments, will you? |
Piping
That's why. |
I'm probably missing something super obvious but is there a reason Mocha wouldn't just blacklist its own flags and pass through anything that doesn't match? I mean, I get that |
This is why; coupled with wanting to list the flags so it's plain to see which flags are invalid and which aren't. For example: If you run The above is more difficult than it needs to be.
Users do a lot of things... |
I suppose this means you wouldn't pass through This all seems very convoluted and limiting to me when the solution to the perceived problem is to tell users to check |
Okay, I understand a bit better now, although it seems easy to fix by adding one line to
Something like 50 extra milliseconds. That's not going to break the bank. I'm not mordicus opposed if we could fix the V8 options issue but I share Anatoli's sentiment that this seems to be a solution in search of a problem. |
@apapirovski This issue is not about whether or not you think that's a real problem or a perceived one. I maintain a module in which thousands of users rely on this behavior and expect it to work. Whether or not you find it helpful, it's helpful to many others. This issue is about the maintenance burden of supporting it, and how that can be significantly reduced by making this information easily accessible in core. |
It'll take a bit longer than that on a Raspberry Pi Zero... |
It's not like I'm blocking any potential work being done on this, I'm just opining as to why I don't think this is a good solution to the problem it's supposed to solve. Even if we assume that this is a good solution, how do we deal with |
This would be a bit non-trivial for us to support given the current mechanism in core for handling command line options. If we could refactor that code, then it is conceivable that we could make it near zero maintenance cost for us to provide this kind of API. I do not see it as being unreasonable at all. |
I don’t think we should support this given how much work it is to do - but if you make a PR and do it in a way that doesn’t make the code harder to maintain then I’m game. |
I gather from external discussion that mocha is probably going down the I'm not aware of other potential users and a lot of work would need to happen to stop it from being a maintenance hassle. Unless someone volunteers to do the work I suggest we close this. |
I think we should give it a few days to see if @boneskull or anyone else is interested in pursuing a PR with an approach that would not make the code harder to maintain. |
News to me... Considering this issue and previous poor experiences attempting to collaborate with Node core, I won’t be sending a PR. |
Ref: #10473 (comment) (Providing specific context for the previous comment, that's all. If anyone wants to have further discussion around that, the probable sensible places for it are probably the issue trackers for https://github.com/nodejs/community-committee/ and/or https://github.com/nodejs/TSC. This issue is probably not the place.) |
`process.allowedNodeEnvironmentFlags` provides an API to validate and list flags as specified in `NODE_OPTIONS` from user code. Refs: nodejs#17740 Signed-off-by: Christopher Hiller <boneskull@boneskull.com>
`process.allowedNodeEnvironmentFlags` provides an API to validate and list flags as specified in `NODE_OPTIONS` from user code. Refs: nodejs#17740 Signed-off-by: Christopher Hiller <boneskull@boneskull.com> PR-URL: nodejs#19335 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Sam Ruby <rubys@intertwingly.net> Reviewed-By: Anna Henningsen <anna@addaleax.net>
`process.allowedNodeEnvironmentFlags` provides an API to validate and list flags as specified in `NODE_OPTIONS` from user code. Refs: #17740 Signed-off-by: Christopher Hiller <boneskull@boneskull.com> PR-URL: #19335 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Sam Ruby <rubys@intertwingly.net> Reviewed-By: Anna Henningsen <anna@addaleax.net>
`process.allowedNodeEnvironmentFlags` provides an API to validate and list flags as specified in `NODE_OPTIONS` from user code. Refs: #17740 Signed-off-by: Christopher Hiller <boneskull@boneskull.com> PR-URL: #19335 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Sam Ruby <rubys@intertwingly.net> Reviewed-By: Anna Henningsen <anna@addaleax.net>
`process.allowedNodeEnvironmentFlags` provides an API to validate and list flags as specified in `NODE_OPTIONS` from user code. Refs: #17740 Signed-off-by: Christopher Hiller <boneskull@boneskull.com> PR-URL: #19335 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Sam Ruby <rubys@intertwingly.net> Reviewed-By: Anna Henningsen <anna@addaleax.net>
@boneskull Can this be closed now that #19335 landed? |
ping @boneskull - is this still outstanding? |
Closing since this seems fixed. |
It'd be useful for Mocha and other certain CLI applications to have a list of supported flags of the current process available.
Many users which to execute a CLI app like
mocha
with Node.js flags, e.g.--experimental-modules
. Mocha spawns anode
process with any requested flags in place, and Mocha loads/runs JavaScript files from within this child process (there may be better ways to do this, but that's not what this issue is about; please put your ideas in Mocha's issue tracker 😉).This puts a maintenance burden on Mocha to explicitly add support for new Node.js flags (I can provide a list of PRs over the years, but this is basically a 1:1 relationship between new Node.js flags and pull requests).
These flags appear in
mocha --help
. Mocha is unable to remove any flags unless it maintained a lookup of Node.js-version-to-allowed-flags itself (FWIW, I'm unsure if Node.js has ever actually removed a flag).(Mocha could simply support something like
--node-flags='--harmony --trace-warnings'
option, but this a little too user-hostile for my taste, and doesn't solve the problem of listing the flags.)Flags listed under
--v8-options
are not shown inmocha --help
, because Mocha can blindly pass through any flag matching^--v8-.*
. In the context of this issue, I'm not proposing v8-specific flags are listed.These two issues (adding new flags, removing old ones) could be mitigated (going forward) if Node.js provided information on allowed flags in its current executable via an Array in
process
. For example:Mocha and other CLI apps like it could consume this information and use it to allow/disallow flags as well as print the information in a "help" page.
Reasonable?
The text was updated successfully, but these errors were encountered: