File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,6 +55,12 @@ def run(config: Config) -> int:
5555 active = True
5656 shutdown_event = ctx .Event ()
5757
58+ def reload (* args : Any ) -> None :
59+ shutdown_event .set ()
60+ for process in processes :
61+ process .join ()
62+ shutdown_event .clear ()
63+
5864 def shutdown (* args : Any ) -> None :
5965 nonlocal active
6066 shutdown_event .set ()
@@ -73,16 +79,16 @@ def shutdown(*args: Any) -> None:
7379 if hasattr (signal , signal_name ):
7480 signal .signal (getattr (signal , signal_name ), shutdown )
7581
82+ if hasattr (signal , "SIGHUP" ):
83+ signal .signal (signal .SIGHUP , reload )
84+
7685 if config .use_reloader :
7786 files = files_to_watch ()
7887 while True :
7988 finished = wait ((process .sentinel for process in processes ), timeout = 1 )
8089 updated = check_for_updates (files )
8190 if updated :
82- shutdown_event .set ()
83- for process in processes :
84- process .join ()
85- shutdown_event .clear ()
91+ reload ()
8692 break
8793 if len (finished ) > 0 :
8894 break
You can’t perform that action at this time.
0 commit comments