summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-03-10 21:44:54 -0800
committerRich Trott <rtrott@gmail.com>2016-03-15 19:22:18 -0700
commitba16a120518e972bb3ac0190196fdb4caa32f4a6 (patch)
tree650caced345b5d13b94b78c1aea340d7e9983a35 /src
parent6ba5af2c2c53f7620fb062c5a24876d71c615d4d (diff)
downloadandroid-node-v8-ba16a120518e972bb3ac0190196fdb4caa32f4a6.tar.gz
android-node-v8-ba16a120518e972bb3ac0190196fdb4caa32f4a6.tar.bz2
android-node-v8-ba16a120518e972bb3ac0190196fdb4caa32f4a6.zip
src: allow combination of -i and -e cli flags
If both -i and -e flags are specified, do not ignore the -i. Instead, launch the interactive REPL and start by evaluating the passed string. Fixes: https://github.com/nodejs/node/issues/1197 PR-URL: https://github.com/nodejs/node/pull/5655 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/node.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/node.js b/src/node.js
index a0f5aec86d..a24338b827 100644
--- a/src/node.js
+++ b/src/node.js
@@ -98,8 +98,9 @@
delete process.env.NODE_UNIQUE_ID;
}
- if (process._eval != null) {
- // User passed '-e' or '--eval' arguments to Node.
+ if (process._eval != null && !process._forceRepl) {
+ // User passed '-e' or '--eval' arguments to Node without '-i' or
+ // '--interactive'
startup.preloadModules();
evalScript('[eval]');
} else if (process.argv[1]) {
@@ -171,6 +172,11 @@
process.exit();
});
});
+
+ if (process._eval != null) {
+ // User passed '-e' or '--eval'
+ evalScript('[eval]');
+ }
} else {
// Read all of stdin - execute it.
process.stdin.setEncoding('utf8');