Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Automatically close FSWatcher on error
Browse files Browse the repository at this point in the history
Closes #3250
  • Loading branch information
piscisaureus committed May 13, 2012
1 parent 5f9ffa1 commit d8351a2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ function FSWatcher() {

this._handle.onchange = function(status, event, filename) {
if (status) {
self._handle.close();
self.emit('error', errnoException(errno, 'watch'));
} else {
self.emit('change', event, filename);
Expand Down

1 comment on commit d8351a2

@bnoordhuis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a test.

Please sign in to comment.