mirror of https://github.com/nodejs/node.git
repl: ensure that 'repl.useGlobal' is a boolean
parent
f41901cdf6
commit
e7065eaa93
|
@ -101,12 +101,12 @@ function REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined) {
|
|||
|
||||
var self = this;
|
||||
|
||||
self.useGlobal = useGlobal;
|
||||
self.useGlobal = !!useGlobal;
|
||||
|
||||
self.eval = eval || function(code, context, file, cb) {
|
||||
var err, result;
|
||||
try {
|
||||
if (useGlobal) {
|
||||
if (self.useGlobal) {
|
||||
result = vm.runInThisContext(code, file);
|
||||
} else {
|
||||
result = vm.runInContext(code, context, file);
|
||||
|
|
Loading…
Reference in New Issue