コード例 #1
0
def watch_directory(path):
    """
    Watch for all events in *path* for 60 seconds.
    """
    with (yield from connect_inotify()) as inotify:
        with (yield from inotify.watch(print_event, path, all_events=True)):
            print('Printing all file system events in {}'.format(path))
            yield from asyncio.sleep(60.0)
            print('And now his watch is ended')
コード例 #2
0
def watch_directory(path):
    inotify = yield from connect_inotify()
    watch = yield from inotify.watch(print_event, path, all_events=True)
    print('Printing all file system events in {}'.format(path))
    yield from asyncio.sleep(60.0)

    print('And now his watch is ended')
    watch.close()
    inotify.close()
コード例 #3
0
ファイル: context_manager.py プロジェクト: mjtorn/aioinotify
def watch_directory(path):
    transport, inotify = yield from connect_inotify()

    with inotify:
        watch = yield from inotify.watch(print_event, path, all_events=True)
        with watch:
            print('Printing all file system events in {}'.format(path))
            yield from asyncio.sleep(60.0)

            print('And now his watch is ended')