summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2018-05-25 22:26:34 -0400
committercjihrig <cjihrig@gmail.com>2018-05-28 13:53:26 -0400
commit4dbfb096f04c49aaa8349626296193ecff6bf2f6 (patch)
tree95558058c31178150231653ebee1df4069ca9ead /lib
parent35cf00842f65077bce64cc25d39b72477afa161e (diff)
downloadandroid-node-v8-4dbfb096f04c49aaa8349626296193ecff6bf2f6.tar.gz
android-node-v8-4dbfb096f04c49aaa8349626296193ecff6bf2f6.tar.bz2
android-node-v8-4dbfb096f04c49aaa8349626296193ecff6bf2f6.zip
Revert "repl: add friendly tips about how to exit repl"
This reverts commit 9aa4ec43fce7fd9166459c98f347760cf450a350. This commit in question introduced a regression in repl.eval(), as the context argument is no longer passed to runInContext(). PR-URL: https://github.com/nodejs/node/pull/20972 Fixes: https://github.com/nodejs/node/issues/20965 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/repl.js18
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/repl.js b/lib/repl.js
index 9935d60fa7..6b5f480387 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -215,15 +215,9 @@ function REPLServer(prompt,
function defaultEval(code, context, file, cb) {
var err, result, script, wrappedErr;
- var isExitCommand = false;
var wrappedCmd = false;
var awaitPromise = false;
var input = code;
- var trimmedCommand = code.trim();
-
- if (trimmedCommand === 'exit' || trimmedCommand === 'quit') {
- isExitCommand = true;
- }
if (/^\s*\{/.test(code) && /\}\s*$/.test(code)) {
// It's confusing for `{ a : 1 }` to be interpreted as a block
@@ -319,16 +313,10 @@ function REPLServer(prompt,
breakOnSigint: self.breakEvalOnSigint
};
- const localContext = self.useGlobal ? global : self.context;
- if (isExitCommand && !localContext.hasOwnProperty(trimmedCommand)) {
- self.outputStream.write('(To exit, press ^D or type .exit)\n');
- return self.displayPrompt();
- }
-
if (self.useGlobal) {
result = script.runInThisContext(scriptOptions);
} else {
- result = script.runInContext(localContext, scriptOptions);
+ result = script.runInContext(context, scriptOptions);
}
} finally {
if (self.breakEvalOnSigint) {
@@ -344,10 +332,12 @@ function REPLServer(prompt,
}
} catch (e) {
err = e;
+
if (err && err.code === 'ERR_SCRIPT_EXECUTION_INTERRUPTED') {
- // The stack trace for this case is not very useful anyway.
+ // The stack trace for this case is not very useful anyway.
Object.defineProperty(err, 'stack', { value: '' });
}
+
if (process.domain) {
debug('not recoverable, send to domain');
process.domain.emit('error', err);