From 2f35bba0830d0f9b6143d447fe0cca25097f899f Mon Sep 17 00:00:00 2001 From: tlrobinson Date: Thu, 24 Dec 2009 19:34:17 -0800 Subject: [PATCH] Print compiler errors to stderr --- lib-js/coffee-script.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib-js/coffee-script.js b/lib-js/coffee-script.js index 1c142e80..7a2f307b 100644 --- a/lib-js/coffee-script.js +++ b/lib-js/coffee-script.js @@ -34,8 +34,10 @@ var coffeePath = FILE.path(module.path).dirname().dirname().join("bin", "coffee- exports.compileFile = function(path) { var coffee = OS.popen([coffeePath, "--print", "--no-wrap", path]); - if (coffee.wait() !== 0) - throw new Error("coffee compiler error"); + if (coffee.wait() !== 0) { + system.stderr.print(coffee.stderr.read()); + throw new Error("coffee-script compile error"); + } return coffee.stdout.read(); } @@ -45,8 +47,10 @@ exports.compile = function(source) { coffee.stdin.write(source).flush().close(); - if (coffee.wait() !== 0) - throw new Error("coffee compiler error"); + if (coffee.wait() !== 0) { + system.stderr.print(coffee.stderr.read()); + throw new Error("coffee-script compile error"); + } return coffee.stdout.read(); }