Report errors when writing files in `coffee`.

This commit is contained in:
Stéphan Kochen 2010-10-19 18:30:29 +02:00
parent 87560d943c
commit e5dfa19ec9
2 changed files with 3 additions and 2 deletions

View File

@ -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) {

View File

@ -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