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()
评论列表
文章目录