Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Stop the watchFileChecker callback from being called twice (closes #110) #113
@remy @drewyoung1 That solution is fine, but I think a simpler way would be to do.
If changeDetected has been toggled, we know the callback has been called already. Only requires one added line,
Only if changeDetected is false, and if it's false, that means that the fs.watch callback never got called. What's going on here is a test to see if fs.watch works. If it does, changeDetected will get toggled to true. If it doesn't, then when the timeout fires, verify will see that changeDetected hasn't been toggled to true, and will call the callback with false, letting the program know that fs.watch isn't supported. There cannot be a circumstance where both verify and fs.watch callbacks are both triggered.
The memory leak seems to be caused by fs.watch triggering more than once for some reason.