Merge pull request #3113 from mklement0/make-repl-use-global-context

Make the REPL *CLI* use the global context to be consistent with the node REPL *CLI*.
This commit is contained in:
Jeremy Ashkenas
2013-10-20 09:17:07 -07:00
2 changed files with 18 additions and 11 deletions

View File

@@ -53,8 +53,11 @@
optionParser = null;
exports.run = function() {
var literals, source, _i, _len, _results;
var literals, replCliOpts, source, _i, _len, _results;
parseOptions();
replCliOpts = {
useGlobal: true
};
if (opts.nodejs) {
return forkNode();
}
@@ -65,7 +68,7 @@
return version();
}
if (opts.interactive) {
return require('./repl').start();
return require('./repl').start(replCliOpts);
}
if (opts.watch && !fs.watch) {
return printWarn("The --watch feature depends on Node v0.6.0+. You are running " + process.version + ".");
@@ -77,7 +80,7 @@
return compileScript(null, sources[0]);
}
if (!sources.length) {
return require('./repl').start();
return require('./repl').start(replCliOpts);
}
literals = opts.run ? sources.splice(1) : [];
process.argv = process.argv.slice(0, 2).concat(literals);