Skip to content

Commit f76b657

Browse files
xkry
authored andcommitted
make "node --eval" eval in the global scope.
1 parent b701498 commit f76b657

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,8 @@ if (process.argv[1]) {
758758

759759
} else if (process._eval) {
760760
// -e, --eval
761-
if (process._eval) console.log(eval(process._eval));
761+
var indirectEval= eval; // so the eval happens in global scope.
762+
if (process._eval) console.log(indirectEval(process._eval));
762763
} else {
763764
// REPL
764765
module.requireNative('repl').start();

0 commit comments

Comments
 (0)