summary refs log tree commit diff
path: root/pkgs/development/tools/aws-sam-cli/use_forward_compatible_log_silencing.patch
blob: 76297875f36ae9e8eaff65e503e3678eeb5ceff2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/samcli/local/services/base_local_service.py b/samcli/local/services/base_local_service.py
index 7b1ab95895d1..76812f02e00a 100644
--- a/samcli/local/services/base_local_service.py
+++ b/samcli/local/services/base_local_service.py
@@ -56,9 +56,11 @@ class BaseLocalService:
 
         LOG.debug("Localhost server is starting up. Multi-threading = %s", multi_threaded)
 
-        # This environ signifies we are running a main function for Flask. This is true, since we are using it within
-        # our cli and not on a production server.
-        os.environ["WERKZEUG_RUN_MAIN"] = "true"
+        # Suppress flask dev server output in a forward-compatible way
+        # Source: https://github.com/cs01/gdbgui/issues/425#issuecomment-1119836533
+        import flask.cli
+
+        flask.cli.show_server_banner = lambda *args: None
 
         self._app.run(threaded=multi_threaded, host=self.host, port=self.port)