Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle host file changes ( not working after vi /etc/hosts ) #70

Merged
merged 1 commit into from Nov 3, 2015
Merged

Handle host file changes ( not working after vi /etc/hosts ) #70

merged 1 commit into from Nov 3, 2015

Conversation

trevershick
Copy link
Contributor

There was a problem whereby VDKQueue wouldn't pick up change events
when I sudo vi /etc/hosts because the file is not just updated,
the file would be removed, then relinked. So the
'write' change never fired because the underlying file handle
changed. This change explictly unregisters interest in /etc/hosts
when stopTrackingFileChanges is called and starts watching for change
and delete events when startTrackingFileChanges is called.

To suspend listening, instead of using a boolean, I simply remove
the 'subscription' in VDKQueue. When i am interested again, we readd
the path which reinitializes the file descriptor.

There was a problem whereby VDKQueue wouldn't pick up change events
when I sudo vi /etc/hosts because the file is not just updated,
the file would be removed, then relinked.  So the
'write' change never fired because the underlying file handle
changed.  This change explictly unregisters interest in /etc/hosts
when stopTrackingFileChanges is called and starts watching for change
and delete events when startTrackingFileChanges is called.

To suspend listening, instead of using a boolean, I simply remove
the 'subscription' in VDKQueue.  When i am interested again, we readd
the path which reinitializes the file descriptor.
2ndalpha added a commit that referenced this pull request Nov 3, 2015
Handle host file changes ( not working after vi /etc/hosts )
@2ndalpha 2ndalpha merged commit c407787 into 2ndalpha:master Nov 3, 2015
@trevershick trevershick deleted the tshick-not-restoring branch November 17, 2015 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants