mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
Make the REPL *CLI* use the global context so as to be consistent with the node REPL CLI.
Make the REPL *CLI* use the global context so as to (a) be consistent with the `node` REPL CLI and, therefore, (b) make packages that modify native prototypes (such as 'colors' and 'sugar') work as expected. Note that, by contrast, programmatic use (`require 'repl'`) will continue to default to a NON-global context - again, consistent with node's behavior.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user