-
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
repl: Default useGlobal
to false in CLI REPL.
#5703
Conversation
|
||
common.globalCheck = false; | ||
|
||
test(); |
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.
This isn't really needed. You can just inline test()
:-)
Tentatively marking as semver-major due to the change in defaults. |
Not sure if this is the place to ask this, but I couldn't find it addressed in CONTRIBUTING.md. Maybe someone on the thread can advise. What's the preferred method for pull request updates? Since I'm rebasing from upstream/master for each of these commits, I have to But what about all of these incremental changes. Since I'm doing a |
It doesn't really matter while the PR is being reviewed. Once it is ready to be landed, it will need to be squashed into a single commit (or multiple commits, broken up logically, if it's a big PR). |
@lance we all force-push to our branches at some point. If you want to do incremental commits and squash later, that is fine. Sometimes I choose one or the other depending on the change. |
Ping. Just checking to see if there is anything more that Committers would like to see addressed here - tidying up loose ends. |
7da4fd4
to
c7066fb
Compare
@lance I don’t think you need to test the case where |
@addaleax just to be clear, the failure case is when |
@lance Eh, yeah, sorry :D I meant |
prompt: '' | ||
}; | ||
repl.createInternalRepl( | ||
process.env, opts, testFunc(useGlobal, cb, opts.output)); |
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.
nit: double indent for statement continuations… or maybe just align the arguments vertically, I think I’d find that easier to read
LGTM with nits addressed + pending CI |
@lance It might be a good idea to write a quick comment when you update PRs so that everyone can see that you did that. :) CI: https://ci.nodejs.org/job/node-test-commit/3392/ and ping @nodejs/ctc because semver-major |
Sorry, perhaps I have forgotten but I'm not particularly clear on what effect this will have. |
@Fishrock123 currently, the CLI defaults |
The effect of this is going to be that the context in which Node’s standard REPL evaluates statements is different from the “default” one, in which virtually all other code, including the REPL’s code itself executes. I think the biggest difference would be that changes occurring on the |
LGTM if the CI is green. |
CI: https://ci.nodejs.org/job/node-test-pull-request/3140/ Yay! I will merge this today. |
Documentation for REPL states that the default value of `useGlobal` is `false`. It makes no distinction between a REPL that is created programmatically, and the one a user is dropped into on the command line by executing `node` with no arguments. This change ensures that the CLI REPL uses a default value of `false`. Fixes: #5659 Ref: #6802 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> PR-URL: #5703
Landed in: 15157c3 |
@cjihrig Should we mark it as non-semver-major? we can always do a revert in |
I would mark it as a bug fix for #6802 until proven otherwise. No tests were harmed while landing this PR. |
Agreed, I’m taking the liberty to remove the |
Documentation for REPL states that the default value of `useGlobal` is `false`. It makes no distinction between a REPL that is created programmatically, and the one a user is dropped into on the command line by executing `node` with no arguments. This change ensures that the CLI REPL uses a default value of `false`. Fixes: #5659 Ref: #6802 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> PR-URL: #5703
Earlier whenever repl was created (`node.exe` with zero parameters), global context was reused. However nodejs/node#5703 fixed it by creating new context for repl. This broke the chakrashim because the context was getting collected immediately. The reason was we were adding the reference of global context to the sandboxed object instead of newly created context. Fixed it by ensuring we add reference to right context. Also contextShim is always initialized when current context was pushed on the scope. However for scenarios like this, we might just create the context and access the objects like global, etc. of that context without going to push scope path. In that case ensure that things are initialized in the new context.
I would let it sit on v6 for a little while first. It almost seems too convenient that nothing broke :-) |
15157c3 changed the CLI REPL to default to useGlobal: false by default. This caused the regression seen in nodejs#7788. This commit adds a known issue test while a proper resolution is determined. Refs: nodejs#5703 Refs: nodejs#7788 PR-URL: nodejs#7793 Reviewed-By: Rich Trott <[email protected]>
due to #7788 I'm adding a dont-land label on this for now |
This is a partial revert of 15157c3. This change lead to a regression that broke require() in the CLI REPL, as imported files were evaluated in a different context. Refs: nodejs#5703 Fixes: nodejs#7788 PR-URL: nodejs#7795 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
This is a partial revert of 15157c3. This change lead to a regression that broke require() in the CLI REPL, as imported files were evaluated in a different context. Refs: #5703 Fixes: #7788 PR-URL: #7795 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
at this time I'm going to opt to not land these changes in LTS. |
Pull Request check-list
make -j8 test
(UNIX) orvcbuild test nosign
(Windows) pass withthis change (including linting)?
test (or a benchmark) included?
existing APIs, or introduces new ones)?
Affected core subsystem(s)
repl
Description of change
This addresses #5659. The
documentation for REPL states that the default value of
useGlobal
isfalse
. It makes no distinction between a REPL that is createdprogrammatically, and the one a user is dropped into on the command line
by executing
node
with no arguments. This change ensures that the CLIREPL uses a default value of
false
.