diff --git a/lib/coffee-script/command.js b/lib/coffee-script/command.js index 59c22ef1..2f197660 100644 --- a/lib/coffee-script/command.js +++ b/lib/coffee-script/command.js @@ -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; diff --git a/src/command.coffee b/src/command.coffee index 44c89c15..27efa13d 100644 --- a/src/command.coffee +++ b/src/command.coffee @@ -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