Skip to content

Commit 8fa3d72

Browse files
committed
Added graceful way of closing HTTP server for coverage
1 parent dc81ad1 commit 8fa3d72

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/test.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,10 @@ def log_message(self, format, *args):
367367

368368
httpd = HTTPServer((host, port), Handler)
369369
print(GREEN + "Serving coverage on" + RESET + f" http://{host}:{port}/ ... (Ctrl+C to exit)")
370-
httpd.serve_forever()
370+
try:
371+
httpd.serve_forever()
372+
except KeyboardInterrupt:
373+
print(RED + "\nServer has been stopped!" + RESET)
371374

372375
def process_result(
373376
result: Result,

0 commit comments

Comments
 (0)