From 70e83030a7624430eb8a89f5d0101898b9ea4aef Mon Sep 17 00:00:00 2001 From: Wil Chung Date: Tue, 12 Mar 2013 16:06:38 -0700 Subject: [PATCH] added warning that we need node 0.8+ to run repl remove unnecessary parens and else statement in repl we do this by convention of the main coffee source fix: exit should be process.exit compiled and build full --- lib/coffee-script/repl.js | 9 ++++++++- src/repl.coffee | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/coffee-script/repl.js b/lib/coffee-script/repl.js index ad0d056f..f69c2fa6 100644 --- a/lib/coffee-script/repl.js +++ b/lib/coffee-script/repl.js @@ -88,10 +88,17 @@ module.exports = { start: function(opts) { - var repl; + var build, major, minor, repl, _ref1; if (opts == null) { opts = {}; } + _ref1 = process.version.slice(1).split('.').map(function(n) { + return parseInt(n); + }), major = _ref1[0], minor = _ref1[1], build = _ref1[2]; + if (major === 0 && minor <= 7) { + console.warn("Node 0.8.0+ required for coffeescript REPL"); + process.exit(1); + } opts = merge(replDefaults, opts); repl = nodeREPL.start(opts); repl.on('exit', function() { diff --git a/src/repl.coffee b/src/repl.coffee index a8620794..db5eed72 100644 --- a/src/repl.coffee +++ b/src/repl.coffee @@ -78,6 +78,12 @@ addMultilineHandler = (repl) -> module.exports = start: (opts = {}) -> + [major, minor, build] = process.version[1..].split('.').map (n) -> parseInt(n) + + if major is 0 and minor <= 7 + console.warn "Node 0.8.0+ required for coffeescript REPL" + process.exit 1 + opts = merge replDefaults, opts repl = nodeREPL.start opts repl.on 'exit', -> repl.outputStream.write '\n'