Using an Inotify object in select
KlaAr36 opened this issue · 0 comments
KlaAr36 commented
I have reason to wait for either inotify events or stdin events and this code works:
observer = inotify.adapters.Inotify()
observer.add_watch(b'tmp')
fd = observer._Inotify__inotify_fd
[r, w, x] = select.select([sys.stdin, fd], [], [], 10)
But I would prefer this solution:
observer = inotify.adapters.Inotify()
observer.add_watch(b'tmp')
[r, w, x] = select.select([sys.stdin, observer], [], [], 10)
I suspect it is a matter of implementing fileno() in Inotify:
def fileno(self):
return self.__inotify_fd