def start_watch(path, callback):
observer = Observer() # ???????
# ?????????????????????????????
# ????????????restart???
# recursive=True??????????????????????
observer.schedule(MyFileSystemEventHander(restart_process), path, recursive=True)
observer.start() # ?????
log('Watching directory %s...' % path)
# ?????????subprocess.Popen??????python??????
start_process()
try:
while True:
time.sleep(0.5)
except KeyboardInterrupt:
observer.stop()
observer.join()
评论列表
文章目录