Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Avoid breaking on ENOTDIR errors #2467

Closed
wants to merge 1 commit into from

2 participants

Attila Oláh Jeremy Ashkenas
Attila Oláh

This may be due to a node.js bug. If so, could anyone please tell me how to report this bug upstream.

Nevertheless this commit fixes the problem, ash all the existing tests are still passing.

Jeremy Ashkenas
Owner

I don't think it would be wise to merge this without hearing about how one can come across this error or reproduce it first.

Jeremy Ashkenas jashkenas closed this
Attila Oláh

@jashkenas I have two test cases attached in #2466 but let me check if it still fails with the most recent node.js.

Attila Oláh

I could not reproduce this with the latest node.js and CoffeeScript versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 28, 2012
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 9 deletions.
  1. +7 −7 lib/coffee-script/command.js
  2. +2 −2 src/command.coffee
14 lib/coffee-script/command.js
View
@@ -111,18 +111,18 @@
watchDir(source, base);
}
return fs.readdir(source, function(err, files) {
- var file, index, _ref1, _ref2;
- if (err && err.code !== 'ENOENT') {
+ var file, index, _ref1, _ref2, _ref3, _ref4;
+ if (err && ((_ref1 = !err.code) === 'ENOENT' || _ref1 === 'ENOTDIR')) {
throw err;
}
- if ((err != null ? err.code : void 0) === 'ENOENT') {
+ if ((_ref2 = err != null ? err.code : void 0) === 'ENOENT' || _ref2 === 'ENOTDIR') {
return;
}
index = sources.indexOf(source);
files = files.filter(function(file) {
return !hidden(file);
});
- [].splice.apply(sources, [index, index - index + 1].concat(_ref1 = (function() {
+ [].splice.apply(sources, [index, index - index + 1].concat(_ref3 = (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = files.length; _i < _len; _i++) {
@@ -130,10 +130,10 @@
_results.push(path.join(source, file));
}
return _results;
- })())), _ref1;
- [].splice.apply(sourceCode, [index, index - index + 1].concat(_ref2 = files.map(function() {
+ })())), _ref3;
+ [].splice.apply(sourceCode, [index, index - index + 1].concat(_ref4 = files.map(function() {
return null;
- }))), _ref2;
+ }))), _ref4;
return files.forEach(function(file) {
return compilePath(path.join(source, file), false, base);
});
4 src/command.coffee
View
@@ -97,8 +97,8 @@ compilePath = (source, topLevel, base) ->
if stats.isDirectory()
watchDir source, base if opts.watch
fs.readdir source, (err, files) ->
- throw err if err and err.code isnt 'ENOENT'
- return if err?.code is 'ENOENT'
+ throw err if err and not err.code in ['ENOENT', 'ENOTDIR']
+ return if err?.code in ['ENOENT', 'ENOTDIR']
index = sources.indexOf source
files = files.filter (file) -> not hidden file
sources[index..index] = (path.join source, file for file in files)
Something went wrong with that request. Please try again.