From 292b4d1cb400265f9e104b6472fd0a5f22edda23 Mon Sep 17 00:00:00 2001 From: EzR1d3r <36864517+EzR1d3r@users.noreply.github.com> Date: Tue, 26 Oct 2021 15:46:32 +0300 Subject: [PATCH] Fix issue #1915 Fix the case when locust stops with exception in headless mode with autoquit != -1 --- locust/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/locust/main.py b/locust/main.py index f5819d2704..5c31483a7b 100644 --- a/locust/main.py +++ b/locust/main.py @@ -324,7 +324,8 @@ def stop_and_optionally_quit(): time.sleep(options.autoquit) logger.info("--autoquit time reached, shutting down") runner.quit() - web_ui.stop() + if web_ui: + web_ui.stop() else: logger.info("--autoquit not specified, leaving web ui running indefinitely") else: # --headless run