File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def _load_config(config_path: Optional[str]) -> Config:
23
23
return Config .from_toml (config_path )
24
24
25
25
26
- def main (sys_args : Optional [List [str ]] = None ) -> None :
26
+ def main (sys_args : Optional [List [str ]] = None ) -> int :
27
27
parser = argparse .ArgumentParser ()
28
28
parser .add_argument (
29
29
"application" , help = "The application to dispatch to as path.to.module:instance.path"
@@ -284,8 +284,8 @@ def _convert_verify_mode(value: str) -> ssl.VerifyMode:
284
284
if len (args .server_names ) > 0 :
285
285
config .server_names = args .server_names
286
286
287
- run (config )
287
+ return run (config )
288
288
289
289
290
290
if __name__ == "__main__" :
291
- main ()
291
+ sys . exit ( main () )
Original file line number Diff line number Diff line change 15
15
from .utils import load_application , wait_for_changes , write_pid_file
16
16
17
17
18
- def run (config : Config ) -> None :
18
+ def run (config : Config ) -> int :
19
+ exit_code = 0
20
+
19
21
if config .pid_path is not None :
20
22
write_pid_file (config .pid_path )
21
23
@@ -77,14 +79,20 @@ def shutdown(*args: Any) -> None:
77
79
78
80
for process in processes :
79
81
process .join ()
82
+ if process .exitcode != 0 :
83
+ exit_code = process .exitcode
84
+
80
85
for process in processes :
81
86
process .terminate ()
82
87
83
88
for sock in sockets .secure_sockets :
84
89
sock .close ()
90
+
85
91
for sock in sockets .insecure_sockets :
86
92
sock .close ()
87
93
94
+ return exit_code
95
+
88
96
89
97
def start_processes (
90
98
config : Config ,
You can’t perform that action at this time.
0 commit comments