-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
src: use option parser for expose_internals #12245
Conversation
src/node.cc
Outdated
@@ -3279,6 +3280,7 @@ void SetupProcessObject(Environment* env, | |||
READONLY_PROPERTY(process, "_forceRepl", True(env->isolate())); | |||
} | |||
|
|||
// -r,--require |
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.
Actually can you add a space here after the comma to be consistent with the other existing comments?
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.
done, thanks (also, fixed up the existing comment which did not use a space)
src/node.cc
Outdated
@@ -3334,6 +3338,11 @@ void SetupProcessObject(Environment* env, | |||
READONLY_PROPERTY(process, "_debugWaitConnect", True(env->isolate())); | |||
} | |||
|
|||
// --expose_internals,--expose-internals |
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.
Ditto
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.
In addition to the other issue mentioned, this should have a minimal test to verify that the property is set.
src/node.cc
Outdated
// --expose_internals,--expose-internals | ||
if (expose_internals) { | ||
READONLY_PROPERTY(process, "_exposeInternals", True(env->isolate())); | ||
} |
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.
Would prefer to use process.binding('config')
for this rather than adding a new _
-prefixed property off process
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.
PTAL, there is no new property created off of process
(its deleted later). I'll add an assertion of that fact to the existing test.
ed9c2e6
to
8675a23
Compare
src/node.cc
Outdated
@@ -3334,6 +3338,13 @@ void SetupProcessObject(Environment* env, | |||
READONLY_PROPERTY(process, "_debugWaitConnect", True(env->isolate())); | |||
} | |||
|
|||
// --expose_internals, --expose-internals | |||
// Note that this is not exposed as a process property, it is deleted when |
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.
@jasnell PTAL
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.
not sure the note is necessary, many setup properties do this
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.
I didn't think it was necessary either, but it confused @jasnell - James, what do you think?
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.
I want confused. I'm not fond of this pattern. Exposing via process.binding('config') is preferable to me.
@@ -5,3 +5,4 @@ require('../common'); | |||
const assert = require('assert'); | |||
|
|||
assert.strictEqual(typeof require('internal/freelist').FreeList, 'function'); | |||
assert(!('_exposeInternals' in process), 'no process property is leaked'); |
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.
@jasnell PTAL, I deliberately am making no change to the process properties (for cleanliness, and because it may potentically be backwards incompat, and also because its unnecessary, we can find if internal modules were exposed pretty easily by just trying to require one and seeing what happens, which is unusual to want to know, but possible).
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.
see
Lines 1219 to 1221 in 8460284
env->process_object()->Delete( | |
env->context(), | |
FIXED_ONE_BYTE_STRING(args.GetIsolate(), "_setupPromises")).FromJust(); |
@sam-github This might also need a rebase after landing #12241. |
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.
@addaleax I'd still prefer the process.binding('config') change to be honest.
@jasnell what change? You saw the property is never visible, and unit test to that effect? You want the property put somewhere else for its brief lifetime? |
4e22b98
to
913a194
Compare
@jasnell I somehow missed your earlier comment, sorry. You actually want this exposed as a new config property? I don't think I'm on-board for that. I'm trying to factor out an oddity where process.argv is re-parsed after it was already parsed, which strikes me as undesireable, not add new APIs that haven't been requested.
|
913a194
to
8b07404
Compare
No, not |
OK, I'll go look |
88ca10f
to
d746bca
Compare
d746bca
to
1b24364
Compare
A few of the CLI option values exposed as properties on the process object were missing a comment, fix this. PR-URL: #12245 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
bootstrap_node.js was directly parsing process.execArgv to see if internals should be exposed, even though the argv was already parsed by node. This is unusual and unnecessary, change it to set the option value from the parser onto the config binding. PR-URL: #12245 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1b24364
to
8086cb6
Compare
@sam-github when you merge multiple commits, could you still comment with |
Should this be backported to |
A few of the CLI option values exposed as properties on the process object were missing a comment, fix this. PR-URL: nodejs#12245 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
bootstrap_node.js was directly parsing process.execArgv to see if internals should be exposed, even though the argv was already parsed by node. This is unusual and unnecessary, change it to set the option value from the parser onto the config binding. PR-URL: nodejs#12245 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
backported: #14483 |
A few of the CLI option values exposed as properties on the process object were missing a comment, fix this. Backport-PR-URL: #14483 PR-URL: #12245 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
bootstrap_node.js was directly parsing process.execArgv to see if internals should be exposed, even though the argv was already parsed by node. This is unusual and unnecessary, change it to set the option value from the parser onto the config binding. Backport-PR-URL: #14483 PR-URL: #12245 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
A few of the CLI option values exposed as properties on the process object were missing a comment, fix this. Backport-PR-URL: #14483 PR-URL: #12245 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
bootstrap_node.js was directly parsing process.execArgv to see if internals should be exposed, even though the argv was already parsed by node. This is unusual and unnecessary, change it to set the option value from the parser onto the config binding. Backport-PR-URL: #14483 PR-URL: #12245 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
A few of the CLI option values exposed as properties on the process object were missing a comment, fix this. Backport-PR-URL: #14483 PR-URL: #12245 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
bootstrap_node.js was directly parsing process.execArgv to see if internals should be exposed, even though the argv was already parsed by node. This is unusual and unnecessary, change it to set the option value from the parser onto the config binding. Backport-PR-URL: #14483 PR-URL: #12245 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
bootstrap_node.js was directly parsing process.execArgv to see if
internals should be exposed, even though the argv was already parsed by
node. This is unusual and unnecessary, change it to set the option value
from the parser onto the process object, as is done for the other CLI
options.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
src