1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Merge pull request #1527 from breckinloggins/fix_1446

Fix for issue #1446: Compiler fails with unrelated exception on file permissions problems
This commit is contained in:
Jeremy Ashkenas 2011-07-18 12:38:23 -07:00
commit 860c5030d2
2 changed files with 8 additions and 0 deletions

View file

@ -90,6 +90,9 @@
if (stats.isDirectory()) {
return fs.readdir(source, function(err, files) {
var file, _k, _len3;
if (err) {
throw err;
}
unprocessed[sourceIndex] += files.length;
for (_k = 0, _len3 = files.length; _k < _len3; _k++) {
file = files[_k];
@ -99,6 +102,9 @@
});
} else if (topLevel || path.extname(source) === '.coffee') {
fs.readFile(source, function(err, code) {
if (err) {
throw err;
}
unprocessed[sourceIndex] -= 1;
if (opts.join) {
contents[sourceIndex] = helpers.compact([contents[sourceIndex], code.toString()]).join('\n');

View file

@ -93,12 +93,14 @@ compileScripts = ->
throw err if err
if stats.isDirectory()
fs.readdir source, (err, files) ->
throw err if err
unprocessed[sourceIndex] += files.length
for file in files
compile path.join(source, file), sourceIndex
unprocessed[sourceIndex] -= 1
else if topLevel or path.extname(source) is '.coffee'
fs.readFile source, (err, code) ->
throw err if err
unprocessed[sourceIndex] -= 1
if opts.join
contents[sourceIndex] = helpers.compact([contents[sourceIndex], code.toString()]).join('\n')