From e5dfa19ec98b3c5691a2a2946344066293899047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Kochen?= Date: Tue, 19 Oct 2010 18:30:29 +0200 Subject: [PATCH] Report errors when writing files in `coffee`. --- lib/command.js | 2 +- src/command.coffee | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/command.js b/lib/command.js index 7d3fda08..69946dff 100644 --- a/lib/command.js +++ b/lib/command.js @@ -166,7 +166,7 @@ js = ' '; } return fs.writeFile(jsPath, js, function(err) { - return opts.compile && opts.watch ? puts("Compiled " + source) : undefined; + return err ? puts(err.message) : (opts.compile && opts.watch ? puts("Compiled " + source) : undefined); }); }; return path.exists(dir, function(exists) { diff --git a/src/command.coffee b/src/command.coffee index 59cf5ef3..d3b0ddc6 100644 --- a/src/command.coffee +++ b/src/command.coffee @@ -149,7 +149,8 @@ writeJs = (source, js, base) -> compile = -> js = ' ' if js.length <= 0 fs.writeFile jsPath, js, (err) -> - puts "Compiled #{source}" if opts.compile and opts.watch + if err then puts err.message + else if opts.compile and opts.watch then puts "Compiled #{source}" path.exists dir, (exists) -> if exists then compile() else exec "mkdir -p #{dir}", compile