예제 #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
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')