From 7d0be6468e33cfb4770289107c975be1f42b73ca Mon Sep 17 00:00:00 2001 From: Jason D'Amour Date: Sat, 12 Oct 2024 14:15:34 -0700 Subject: [PATCH] feat: add option to log when the server is listening when waiting for client, so that clients can trigger attaching --- src/debugpy/server/cli.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/debugpy/server/cli.py b/src/debugpy/server/cli.py index 5e0520da8..964df41be 100644 --- a/src/debugpy/server/cli.py +++ b/src/debugpy/server/cli.py @@ -49,6 +49,7 @@ class Options(object): target: Union[str, None] = None target_kind: Union[str, None] = None wait_for_client = False + log_on_listening = True adapter_access_token = None config: Dict[str, Any] = {} @@ -177,6 +178,7 @@ def do(arg, it): ("--listen", "
", set_address("listen")), ("--connect", "
", set_address("connect")), ("--wait-for-client", None, set_const("wait_for_client", True)), + ("--log-on-listening", None, set_const("log_on_listening", True)), ("--configure-.+", "", set_config), # Switches that are used internally by the client or debugpy itself. @@ -325,6 +327,8 @@ def start_debugging(argv_0): raise AssertionError(repr(options.mode)) if options.wait_for_client: + if options.log_on_listening: + print(f"Listening for debugger connection on {options.address[0]}:{options.address[1]}") debugpy.wait_for_client() os.environ["DEBUGPY_RUNNING"] = "true"