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