Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 7e10102

Browse files
committed
Remove the old one if we found two same file handles.
Somehow sometimes the binding.watch would return a handle that was already taken by a live handler, I have no idea of why this happened, but we simply remove the old one for now so we do not have to throw an exception.
1 parent c527306 commit 7e10102

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/main.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ class HandleWatcher extends EventEmitter
4040
@handle = binding.watch(@path)
4141
if handleWatchers.has(@handle)
4242
troubleWatcher = handleWatchers.get(@handle)
43-
throw new Error("The handle(#{@handle}) returned by watching #{@path} is the same with an already watched path(#{troubleWatcher.path})")
43+
troubleWatcher.close()
44+
console.error("The handle(#{@handle}) returned by watching #{@path} is the same with an already watched path(#{troubleWatcher.path})")
4445
handleWatchers.add(@handle, this)
4546

4647
closeIfNoListener: ->

0 commit comments

Comments
 (0)