repl: ensure that 'repl.useGlobal' is a boolean

pull/24503/head
Nathan Rajlich 2012-03-27 17:34:55 -07:00
parent f41901cdf6
commit e7065eaa93
1 changed files with 2 additions and 2 deletions

View File

@ -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);