You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting this error a lot while using gaze to watch a directory, and using Sublime Text 3 (on OS X Mountain Lion) to edit files in that directory. About 1 in every 5 saves causes my Node process to exit with this error:
Error: ENOENT, no such file or directory '/Users/callum.locke/code/ft/ft/manual/exp2-app/.subl38b.tmp'
at Object.fs.lstatSync (fs.js:679:18)
at /Users/callum.locke/code/exp/node_modules/gaze/lib/gaze.js:270:21
at iterate (/Users/callum.locke/code/exp/node_modules/gaze/lib/helper.js:106:5)
at Object.forEachSeries (/Users/callum.locke/code/exp/node_modules/gaze/lib/helper.js:121:3)
at /Users/callum.locke/code/exp/node_modules/gaze/lib/gaze.js:267:12
at ReaddirReq.Req.done (/Users/callum.locke/code/exp/node_modules/gaze/node_modules/graceful-fs/graceful-fs.js:143:5)
at ReaddirReq.done (/Users/callum.locke/code/exp/node_modules/gaze/node_modules/graceful-fs/graceful-fs.js:90:22)
at ReaddirReq.Req.done (/Users/callum.locke/code/ft/web/node_modules/graceful-fs/graceful-fs.js:143:5)
at ReaddirReq.done (/Users/callum.locke/code/ft/web/node_modules/graceful-fs/graceful-fs.js:90:22)
at Object.oncomplete (fs.js:107:15)
fs.exists() is an anachronism and exists only for historical reasons. There should almost never be a reason to use it in your own code.
In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to fs.exists() and fs.open(). Just open the file and handle the error when it's not there.
The text was updated successfully, but these errors were encountered:
I'm getting this error a lot while using gaze to watch a directory, and using Sublime Text 3 (on OS X Mountain Lion) to edit files in that directory. About 1 in every 5 saves causes my Node process to exit with this error:
The problem is lines 270-271 in
lib/gaze.js
:I think this is probably due to this thing explained in the Node docs for fs.exists:
The text was updated successfully, but these errors were encountered: