Skip to content

Commit

Permalink
Use self.* in callback to update and close watcher (nodejs#97)
Browse files Browse the repository at this point in the history
onchange callback sets this to the reported FSEvent rather than the
outer FSWatcher
  • Loading branch information
shiftkey authored and codebytere committed Mar 23, 2019
1 parent fcaf11a commit 7658ffa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1380,10 +1380,10 @@ function FSWatcher() {
// after the handle is closed, and to fire both UV_RENAME and UV_CHANGE
// if they are set by libuv at the same time.
if (status < 0) {
if (this._handle !== null) {
if (self._handle !== null) {
// We don't use this.close() here to avoid firing the close event.
this._handle.close();
this._handle = null; // make the handle garbage collectable
self._handle.close();
self._handle = null; // make the handle garbage collectable
}
const error = errors.uvException({
errno: status,
Expand Down

0 comments on commit 7658ffa

Please sign in to comment.