-
Notifications
You must be signed in to change notification settings - Fork 284
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
implement inotify directory watcher #743
Conversation
Thanks a lot! So the "let's pretend D is a scripting language" game can finally start ;) Looks like the wrong BTW, for Mac OS it looks like Obj-C is necessary ( |
implement inotify directory watcher
I think it can be done with kqueue on OSX/FreeBSD. |
kqueue on FreeBSD and Mac is the way to go from what I've read. I'm basing that largely on what Nginx does. Nginx uses epoll by default for monitoring on Linux and kqueue by default for monitoring on FreeBSD and Mac OSX, etc. |
Yes, looks like kqueue can do that, too, and it definitely is the target for server/command line applications. My misconception came from an earlier need to have something that integrates well with a Cocoa application. This will still be important in the future, but that's a different topic. |
If recursion is desired, I believe FSEvents is what would be used: Being notified which file changed is only supported in OSX 10.7 or higher, but that's probably a reasonable requirement. |
type = DirectoryChangeType.modified; | ||
|
||
import std.path : buildPath; | ||
auto name = ev.name.ptr[0 .. ev.name.ptr.strlen]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seem to be getting a SEGV here on my 32bit server, but not on my 64bit dev machine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmh, the inotify_event struct looks declaration seems to be correct. Can you print out nread?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... seem to have been a bug when built with the gdc-2.064 binaries. I've switched to gdc-2.065 and it's gone away. This might be difficult to track down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it also works for me with -m32
on dmd.2.065.
No description provided.