Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upMigrating from process.binding('config') to getOptions() #23588
Conversation
targos
added
the
code-and-learn
label
Oct 12, 2018
jasnell
approved these changes
Oct 12, 2018
devsnek
reviewed
Oct 12, 2018
| @@ -137,7 +137,7 @@ | |||
| setupQueueMicrotask(); | |||
| } | |||
|
|
|||
| if (process.binding('config').experimentalWorker) { | |||
| if (internalBinding('options').getOptions('--experimental-worker')) { | |||
This comment has been minimized.
This comment has been minimized.
devsnek
Oct 12, 2018
Member
can you factor out the internalBinding into a single call up top and also save the flag calls as variables to be used later?
something like
const { getOptions } = internalBinding('options');
const experimentalModules = getOptions('experimentalModules');
// ...
if (experimentalModules) {
// ...
This comment has been minimized.
This comment has been minimized.
burgerboydaddy
Oct 14, 2018
•
Author
Contributor
Yes I will do that.
But one question. There is already some similar code in place, like line 114:
const options = internalBinding('options');
if (options.getOptions('--help')) {
NativeModule.require('internal/print_help').print(process.stdout);
return;
}
Should I redo that part also and change code to use as mentioned:
const { getOptions } = internalBinding('options');
const experimentalModules = getOptions('experimentalModules');
// ...
if (experimentalModules) {
// ...
Thanks
This comment has been minimized.
This comment has been minimized.
burgerboydaddy
Oct 14, 2018
Author
Contributor
As mentioned in my previous comment, will code like this (replacing line 114) be Ok:
const { getOptions } = internalBinding('options');
const helpOption = getOptions('--help');
const completionBashOption = getOptions('--completion-bash');
const experimentalModulesOption = getOptions('--experimental-modules');
const experimentalVMModulesOption = getOptions('--experimental-vm-modules');
const experimentalWorkerOption = getOptions('--experimental-worker');
This comment has been minimized.
This comment has been minimized.
gireeshpunathil
approved these changes
Oct 13, 2018
|
approving with @devsnek 's suggestion |
thefourtheye
approved these changes
Oct 13, 2018
|
LGTM with @devsnek's suggestion. |
burgerboydaddy
force-pushed the
burgerboydaddy:node-contrib1
branch
from
678e0f4
to
7d85fb6
Oct 17, 2018
burgerboydaddy
added a commit
to burgerboydaddy/node
that referenced
this pull request
Oct 17, 2018
burgerboydaddy
added a commit
to burgerboydaddy/node
that referenced
this pull request
Oct 17, 2018
burgerboydaddy
added a commit
to burgerboydaddy/node
that referenced
this pull request
Oct 17, 2018
This comment has been minimized.
This comment has been minimized.
|
Added suggested changes to the code
Please review. |
addaleax
reviewed
Oct 17, 2018
| @@ -183,7 +188,7 @@ | |||
| { | |||
| // Install legacy getters on the `util` binding for typechecking. | |||
| // TODO(addaleax): Turn into a full runtime deprecation. | |||
| const { pendingDeprecation } = process.binding('config'); | |||
| const { pendingDeprecation } = internalBinding('options').getOptions(); | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
burgerboydaddy
Oct 18, 2018
Author
Contributor
@addaleax initial request was to replace process.binding('config') to
internalBinding('options).getOptions(). Is there any reason why this line shouldn't be included?
If yes, I will restore this line to original one.
Please let me know what is your opinion.
thanks
This comment has been minimized.
This comment has been minimized.
|
Fixed issues.
|
trivikr
approved these changes
Oct 20, 2018
This comment has been minimized.
This comment has been minimized.
|
@burgerboydaddy Something seems to be odd here … github says there are about 200 commits in this PR, some of which are merge commits? Do you think you could rebase this against |
This comment has been minimized.
This comment has been minimized.
|
@addaleax I'm even thinking to re-do complete request (new PR). Will that be better? |
This comment has been minimized.
This comment has been minimized.
|
@burgerboydaddy You can do that, but rebasing this one should be totally fine as well – whichever you prefer |
This comment has been minimized.
This comment has been minimized.
@addaleax This are command that I just executed:
During rebase got error:
I fixed issue with file that I changed (node.js). After that did:
But after rebase --continue received response:
What should I do? |
This comment has been minimized.
This comment has been minimized.
|
@burgerboydaddy That’s odd … it would typically mean that the changes from your commits have already happened upstream; but that’s clearly not the case, so I’m not sure what to do with that. |
This comment has been minimized.
This comment has been minimized.
burgerboydaddy
added some commits
Oct 12, 2018
Trott
force-pushed the
burgerboydaddy:node-contrib1
branch
from
5a49556
to
7636912
Oct 22, 2018
This comment has been minimized.
This comment has been minimized.
|
Rebased, addressed merge conflict, force pushed. |
Trott
added some commits
Oct 22, 2018
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Resume Build: https://ci.nodejs.org/job/node-test-pull-request/18063/ |
This comment has been minimized.
This comment has been minimized.
|
Resume Build: https://ci.nodejs.org/job/node-test-pull-request/18080/ |
This comment has been minimized.
This comment has been minimized.
|
Just landed a PR to fix the unreliable test that failed last CI run... Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/18094/ |
Trott
added a commit
to Trott/io.js
that referenced
this pull request
Oct 24, 2018
This comment has been minimized.
This comment has been minimized.
|
Landed in bb79e76. Thanks for the contribution! (If you're interested in other possible contributions to Node.js but don't have a good idea of where to start looking, some ideas are posted at https://www.nodetodo.org/next-steps/.) |
burgerboydaddy commentedOct 12, 2018
Change inside /lib/internal/bootstrap/node.js code from
process.binding('config') to
internalBinding('options).getOptions()
Changes are done for options:
--experimental-modules
--experimental-vm-modules
--experimental-worker
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes