Skip to content

Commit f4b205c

Browse files
authored
fix: pass main filepath to watcher, remove unused imports
1 parent d4c573f commit f4b205c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

main.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
Main script for mitmproxy
55
"""
66

7-
import os
87
import sys
9-
import pkgutil
108
import asyncio
11-
import importlib
9+
from pathlib import Path
1210

1311
from mitmproxy import ctx, contentviews
1412
from reloader import watch_changes, reload_modules
@@ -19,15 +17,19 @@
1917
from addons.no_cache import NoCache
2018
from addons.debug import Debug
2119

22-
# Redirect stdout
20+
# Redirect all stdout to stderr
2321
sys.stdout = sys.stderr
2422

25-
# Hot Reloading
23+
# HotReloading
2624
for task in asyncio.all_tasks():
2725
if task.get_name() == 'watch_changes':
2826
ctx.log.info("Canceling previous autoreload task")
2927
task.cancel()
30-
asyncio.create_task(watch_changes(), name="watch_changes")
28+
29+
asyncio.create_task(
30+
watch_changes(trigger_file=Path(__file__)),
31+
name="watch_changes"
32+
)
3133

3234
reload_modules([
3335
"addons",
@@ -47,7 +49,10 @@
4749
ViewSekai(),
4850
]
4951

52+
####
5053
# This code is required for adding/removing views
54+
####
55+
5156
def load(loader):
5257
for view in views:
5358
contentviews.add(view)

0 commit comments

Comments
 (0)