Skip to content

Commit

Permalink
fix: osx hide-bazel-files issue with fsevents
Browse files Browse the repository at this point in the history
      // Not sure how but the following was observed on OSX:
      // `Error: ENOENT: no such file or directory, lstat
      // '/private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-49206kt9HWV3A8daE/node_modules/fsevents'`
      // It seems that there are filesystem race conditions on OSX; this may be related
      // to the general flakes we are seeing on OSX which show up on buildkite quite a bit.
      // In the above case my `fsevents` install failed because of `gyp: No Xcode or CLT version
      // detected!` so my guess is that as this is a optional dependency, there was a transient
      // `node_modules/fsevents` folder which was removed but somehow still picked up by
      // `fs.readdirSync` above. But since that folder was removed fs.lstatSync throws.
      // TODO(gregmagolan): get to the bottom of the filesystem issues on OSX
  • Loading branch information
gregmagolan committed Jan 28, 2020
1 parent 0b4ef06 commit fdd8681
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/hide-bazel-files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,22 @@ function findBazelFiles(dir) {
}
return fs.readdirSync(dir).reduce((files, file) => {
const fullPath = path.posix.join(dir, file);
const isSymbolicLink = fs.lstatSync(fullPath).isSymbolicLink();
let isSymbolicLink;
try {
isSymbolicLink = fs.lstatSync(fullPath).isSymbolicLink();
} catch (e) {
// Not sure how but the following was observed on OSX:
// `Error: ENOENT: no such file or directory, lstat
// '/private/var/folders/0l/nj_q9kzj49gdz1w6f5v9tw3h0000gn/T/tmp-49206kt9HWV3A8daE/node_modules/fsevents'`
// It seems that there are filesystem race conditions on OSX; this may be related
// to the general flakes we are seeing on OSX which show up on buildkite quite a bit.
// In the above case my `fsevents` install failed because of `gyp: No Xcode or CLT version
// detected!` so my guess is that as this is a optional dependency, there was a transient
// `node_modules/fsevents` folder which was removed but somehow still picked up by
// `fs.readdirSync` above. But since that folder was removed fs.lstatSync throws.
// TODO(gregmagolan): get to the bottom of the filesystem issues on OSX
return files;
}
let stat;
try {
stat = fs.statSync(fullPath);
Expand Down

0 comments on commit fdd8681

Please sign in to comment.