aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/script
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-11-26 14:59:54 +0100
committerMaximilian Hils <git@maximilianhils.com>2015-11-26 14:59:54 +0100
commit3eea7f12162804dcf472740209ac340f7b6c4ba9 (patch)
tree7dfdaa7c5dbee307a997a99f492cdfbd4bd92a7e /libmproxy/script
parent63355421edb26d9fd84929ca0619604cbcefedf0 (diff)
downloadmitmproxy-3eea7f12162804dcf472740209ac340f7b6c4ba9.tar.gz
mitmproxy-3eea7f12162804dcf472740209ac340f7b6c4ba9.tar.bz2
mitmproxy-3eea7f12162804dcf472740209ac340f7b6c4ba9.zip
script reloader: minor fixes
Diffstat (limited to 'libmproxy/script')
-rw-r--r--libmproxy/script/reloader.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/libmproxy/script/reloader.py b/libmproxy/script/reloader.py
index b867238f..26691fa3 100644
--- a/libmproxy/script/reloader.py
+++ b/libmproxy/script/reloader.py
@@ -6,6 +6,8 @@ _observers = {}
def watch(script, callback):
+ if script in _observers:
+ raise RuntimeError("Script already observed")
script_dir = os.path.dirname(os.path.abspath(script.args[0]))
event_handler = _ScriptModificationHandler(callback)
observer = Observer()
@@ -18,6 +20,7 @@ def unwatch(script):
observer = _observers.pop(script, None)
if observer:
observer.stop()
+ observer.join()
class _ScriptModificationHandler(PatternMatchingEventHandler):