(self)
| 131 | ctx.master.addons.invoke_addon_sync(self.ns, hooks.RunningHook()) |
| 132 | |
| 133 | async def watcher(self): |
| 134 | # Script loading is terminally confused at the moment. |
| 135 | # This here is a stopgap workaround to defer loading. |
| 136 | await asyncio.sleep(0) |
| 137 | last_mtime = 0.0 |
| 138 | while True: |
| 139 | try: |
| 140 | mtime = os.stat(self.fullpath).st_mtime |
| 141 | except FileNotFoundError: |
| 142 | logger.info("Removing script %s" % self.path) |
| 143 | scripts = list(ctx.options.scripts) |
| 144 | scripts.remove(self.path) |
| 145 | ctx.options.update(scripts=scripts) |
| 146 | return |
| 147 | if mtime > last_mtime: |
| 148 | self.loadscript() |
| 149 | last_mtime = mtime |
| 150 | await asyncio.sleep(ReloadInterval) |
| 151 | |
| 152 | |
| 153 | class ScriptLoader: |
no test coverage detected