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

Ignoring exception thrown when trying to re-watch a file after rename

This commit is contained in:
Trevor Burnham 2011-11-10 14:44:48 +01:00
parent d30aa6d621
commit 1ce92d1aeb
2 changed files with 5 additions and 2 deletions

View file

@ -202,7 +202,9 @@
return watcher = fs.watch(source, callback = function(event) {
if (event === 'rename') {
watcher.close();
return watcher = fs.watch(source, callback);
try {
return watcher = fs.watch(source, callback);
} catch (_error) {}
} else if (event === 'change') {
return fs.stat(source, function(err, stats) {
if (err) throw err;

View file

@ -177,7 +177,8 @@ watch = (source, base) ->
watcher = fs.watch source, callback = (event) ->
if event is 'rename'
watcher.close()
watcher = fs.watch source, callback
try # if source no longer exists, never mind
watcher = fs.watch source, callback
else if event is 'change'
fs.stat source, (err, stats) ->
throw err if err