テスト用
This commit is contained in:
parent
3f1611dde1
commit
4d391c7a9a
1 changed files with 22 additions and 0 deletions
22
temp/kill.py
Normal file
22
temp/kill.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
import wmi
|
||||
import asyncio
|
||||
|
||||
async def watcher():
|
||||
c=wmi.WMI()
|
||||
cre_process_watcher=c.Win32_Process.watch_for("creation")
|
||||
del_process_watcher=c.Win32_Process.watch_for("deletion")
|
||||
|
||||
while True:
|
||||
new_cre_process=cre_process_watcher()
|
||||
new_del_process=del_process_watcher()
|
||||
print(new_cre_process.Caption+" has been created")
|
||||
print(new_del_process.Caption+" has been deleted ")
|
||||
|
||||
async def main():
|
||||
kill_task = asyncio.TaskGroup(watcher())
|
||||
print('hello world')
|
||||
await asyncio.sleep(1)
|
||||
print('1sec')
|
||||
await kill_task
|
||||
|
||||
asyncio.run(main())
|
Loading…
Reference in a new issue