reloopd.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:reloop 作者: datawire 项目源码 文件源码
def run():
    if not watch:
        exit(1)

    if before_command:
        click.echo('==> reloopd, INFO  : running RELOOP_BEFORE_CMD')
        subprocess.call(shlex.split(before_command))

    if not command:
        click.echo('ERROR: environment variable RELOOP_CMD is not set! Exiting.')
        exit(1)

    global proc
    proc = subprocess.Popen(shlex.split(command))

    click.echo('==> reloopd, INFO  : watching {0} {1})'.format(('directory' if os.path.isdir(watch) else 'file'),
                                                               os.path.abspath(watch)))

    notifier = inotify.INotify()
    notifier.startReading()
    # recursive=True causes this whole thing to barely work... no FS changes will be detected.
    notifier.watch(filepath.FilePath(str(os.path.abspath(watch))), autoAdd=True, callbacks=[on_change], recursive=True)
    reactor.run()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号