Browse Source

add sample program testing if a directory can be watched

main
John-Mark Gurney 4 years ago
parent
commit
9e082a8487
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      misc/kqdir.py

+ 14
- 0
misc/kqdir.py View File

@@ -0,0 +1,14 @@
import aiokq
import asyncio
import os

fd = os.open('.', os.O_RDONLY)

async def foo():
async with aiokq.watch_file(fd) as wf:
print('a')
await wf()
print('b')

loop = asyncio.get_event_loop()
loop.run_until_complete(foo())

Loading…
Cancel
Save