Skip to content

repl: do not run --eval code if there is none - #27587

Closed
addaleax wants to merge 2 commits into
nodejs:masterfrom
addaleax:fix-27575
Closed

repl: do not run --eval code if there is none#27587
addaleax wants to merge 2 commits into
nodejs:masterfrom
addaleax:fix-27575

Conversation

@addaleax

Copy link
Copy Markdown
Member

getOptionValue('--eval') always returns a string, so it is never
loose-equal to null. Running eval makes some modifications to the
global object, including setting module to a different value, which
we want to avoid if possible.

Refs: #27278
Fixes: #27575

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

`getOptionValue('--eval')` always returns a string, so it is never
loose-equal to `null`. Running eval makes some modifications to the
global object, including setting `module` to a different value, which
we want to avoid if possible.
Refs: nodejs#27278Fixes: nodejs#27575
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@addaleaxaddaleax added the repl Issues and PRs related to the REPL subsystem. label May 6, 2019
@addaleaxaddaleax mentioned this pull request May 6, 2019
@BridgeAR

Copy link
Copy Markdown
Member

@addaleax this keeps on failing? Does it maybe only fix some cases? (I did not check closer)

@addaleax

Copy link
Copy Markdown
MemberAuthor

@BridgeAR Yes, thanks for pointing that out – my test was better than my code. I’ve added another commit that should solve that issue (and probably technically renders the former commit unnecessary, but I still think it’s more correct this way).

@TrottTrott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 10, 2019
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@joyeecheungjoyeecheung left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should lib/internal/main/eval_string.js be fixed as well?

@addaleax

Copy link
Copy Markdown
MemberAuthor

@joyeecheung I don’t think so, because at that point it’s already clear that there is an --eval argument present (unless I’m misunderstanding what you’re saying)

@addaleax

Copy link
Copy Markdown
MemberAuthor

Landed in 1d31c68...b230833

@addaleax
addaleax deleted the fix-27575 branch May 12, 2019 13:40
addaleax added a commit that referenced this pull request May 12, 2019
`getOptionValue('--eval')` always returns a string, so it is never
loose-equal to `null`. Running eval makes some modifications to the
global object, including setting `module` to a different value, which
we want to avoid if possible.
Refs: #27278
PR-URL: #27587
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
addaleax added a commit that referenced this pull request May 12, 2019
PR-URL: #27587Fixes: #27575
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@joyeecheung

Copy link
Copy Markdown
Member

@addaleax ah, right, in that case there is already a env->options()->has_eval_string check in the C++ before the main script is run..

targos pushed a commit that referenced this pull request May 13, 2019
`getOptionValue('--eval')` always returns a string, so it is never
loose-equal to `null`. Running eval makes some modifications to the
global object, including setting `module` to a different value, which
we want to avoid if possible.
Refs: #27278
PR-URL: #27587
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
targos pushed a commit that referenced this pull request May 13, 2019
PR-URL: #27587Fixes: #27575
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@BridgeARBridgeAR mentioned this pull request May 21, 2019
4 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.replIssues and PRs related to the REPL subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong root module in REPL

10 participants

@addaleax@nodejs-github-bot@BridgeAR@joyeecheung@jdalton@fhinkel@jasnell@Trott@cjihrig@devsnek