示例#1
0
 def __iadd__(self, watch):
     # TODO: str to char * conversion below won't work in python 3.x
     wd = libc.inotify_add_watch(self.inotifyfd, ctypes.c_char_p(watch.pathname), watch.events)
     if wd == -1:
         raise OSError
     debug("watcher added on path %s for events 0x%08x (wd=%d)" % (watch.pathname, watch.events, wd))
     self.watchers[wd] = watch
     watch.wd = wd