瀏覽代碼

add sample program testing if a directory can be watched

main
John-Mark Gurney 4 年之前
父節點
當前提交
9e082a8487
共有 1 個檔案被更改,包括 14 行新增0 行删除
  1. +14
    -0
      misc/kqdir.py

+ 14
- 0
misc/kqdir.py 查看文件

@@ -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…
取消
儲存