robotcode-debugger 0.80.0__tar.gz → 0.82.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/PKG-INFO +4 -4
  2. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/pyproject.toml +3 -3
  3. robotcode_debugger-0.82.0/src/robotcode/debugger/__version__.py +1 -0
  4. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/cli.py +25 -27
  5. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/protocol.py +3 -6
  6. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/run.py +61 -63
  7. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/server.py +31 -31
  8. robotcode_debugger-0.80.0/src/robotcode/debugger/__version__.py +0 -1
  9. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/.gitignore +0 -0
  10. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/LICENSE.txt +0 -0
  11. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/README.md +0 -0
  12. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/__init__.py +0 -0
  13. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/dap_types.py +0 -0
  14. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/debugger.py +0 -0
  15. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/hooks.py +0 -0
  16. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/launcher/__init__.py +0 -0
  17. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/launcher/cli.py +0 -0
  18. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/launcher/client.py +0 -0
  19. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/launcher/run.py +0 -0
  20. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/launcher/server.py +0 -0
  21. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/listeners.py +0 -0
  22. {robotcode_debugger-0.80.0 → robotcode_debugger-0.82.0}/src/robotcode/debugger/py.typed +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: robotcode-debugger
3
- Version: 0.80.0
3
+ Version: 0.82.0
4
4
  Summary: RobotCode Debugger for Robot Framework
5
5
  Project-URL: Homepage, https://robotcode.io
6
- Project-URL: Donate, https://github.com/sponsors/d-biehl
6
+ Project-URL: Donate, https://opencollective.com/robotcode
7
7
  Project-URL: Documentation, https://github.com/robotcodedev/robotcode#readme
8
8
  Project-URL: Changelog, https://github.com/robotcodedev/robotcode/blob/main/CHANGELOG.md
9
9
  Project-URL: Issues, https://github.com/robotcodedev/robotcode/issues
@@ -25,8 +25,8 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy
25
25
  Classifier: Topic :: Utilities
26
26
  Classifier: Typing :: Typed
27
27
  Requires-Python: >=3.8
28
- Requires-Dist: robotcode-jsonrpc2==0.80.0
29
- Requires-Dist: robotcode-runner==0.80.0
28
+ Requires-Dist: robotcode-jsonrpc2==0.82.0
29
+ Requires-Dist: robotcode-runner==0.82.0
30
30
  Requires-Dist: robotframework>=4.1.0
31
31
  Provides-Extra: debugpy
32
32
  Requires-Dist: debugpy; extra == 'debugpy'
@@ -28,8 +28,8 @@ classifiers = [
28
28
  dynamic = ["version"]
29
29
  dependencies = [
30
30
  "robotframework>=4.1.0",
31
- "robotcode-jsonrpc2==0.80.0",
32
- "robotcode-runner==0.80.0",
31
+ "robotcode-jsonrpc2==0.82.0",
32
+ "robotcode-runner==0.82.0",
33
33
  ]
34
34
 
35
35
  [project.optional-dependencies]
@@ -40,7 +40,7 @@ debugger = "robotcode.debugger.hooks"
40
40
 
41
41
  [project.urls]
42
42
  Homepage = "https://robotcode.io"
43
- Donate = "https://github.com/sponsors/d-biehl"
43
+ Donate = "https://opencollective.com/robotcode"
44
44
  Documentation = "https://github.com/robotcodedev/robotcode#readme"
45
45
  Changelog = "https://github.com/robotcodedev/robotcode/blob/main/CHANGELOG.md"
46
46
  Issues = "https://github.com/robotcodedev/robotcode/issues"
@@ -0,0 +1 @@
1
+ __version__ = "0.82.0"
@@ -1,4 +1,3 @@
1
- import asyncio
2
1
  from typing import Optional, Sequence, Tuple
3
2
 
4
3
  import click
@@ -22,7 +21,8 @@ DEBUGPY_DEFAULT_PORT = 5678
22
21
  add_help_option=True,
23
22
  )
24
23
  @click.option(
25
- "--debug / --no-debug",
24
+ "--debug/--no-debug",
25
+ is_flag=True,
26
26
  default=True,
27
27
  help="Enable/disable debug mode",
28
28
  show_default=True,
@@ -34,7 +34,7 @@ DEBUGPY_DEFAULT_PORT = 5678
34
34
  show_default=True,
35
35
  )
36
36
  @click.option(
37
- "--wait-for-client / --no-wait-for-client",
37
+ "--wait-for-client/--no-wait-for-client",
38
38
  is_flag=True,
39
39
  default=True,
40
40
  help="Waits until a debug client is connected.",
@@ -55,14 +55,14 @@ DEBUGPY_DEFAULT_PORT = 5678
55
55
  show_default=True,
56
56
  )
57
57
  @click.option(
58
- "--debugpy / --no-debugpy",
58
+ "--debugpy/--no-debugpy",
59
59
  is_flag=True,
60
60
  default=False,
61
61
  help="Enable/disable python debugging.",
62
62
  show_default=True,
63
63
  )
64
64
  @click.option(
65
- "--debugpy-wait-for-client",
65
+ "--debugpy-wait-for-client/--no-debugpy-wait-for-client",
66
66
  is_flag=True,
67
67
  default=True,
68
68
  help="Waits for a debugpy client to connect.",
@@ -170,28 +170,26 @@ def debug(
170
170
 
171
171
  try:
172
172
  app.exit(
173
- asyncio.run(
174
- run_debugger(
175
- ctx=ctx,
176
- app=app,
177
- args=list(robot_options_and_args),
178
- mode=mode,
179
- addresses=bind,
180
- port=port if port is not None else DEBUGGER_DEFAULT_PORT,
181
- pipe_name=pipe_name,
182
- debug=debug,
183
- stop_on_entry=stop_on_entry,
184
- wait_for_client=wait_for_client,
185
- wait_for_client_timeout=wait_for_client_timeout,
186
- configuration_done_timeout=configuration_done_timeout,
187
- debugpy=debugpy,
188
- debugpy_wait_for_client=debugpy_wait_for_client,
189
- debugpy_port=debugpy_port,
190
- output_messages=output_messages,
191
- output_log=output_log,
192
- output_timestamps=output_timestamps,
193
- group_output=group_output,
194
- )
173
+ run_debugger(
174
+ ctx=ctx,
175
+ app=app,
176
+ args=list(robot_options_and_args),
177
+ mode=mode,
178
+ addresses=bind,
179
+ port=port if port is not None else DEBUGGER_DEFAULT_PORT,
180
+ pipe_name=pipe_name,
181
+ debug=debug,
182
+ stop_on_entry=stop_on_entry,
183
+ wait_for_client=wait_for_client,
184
+ wait_for_client_timeout=wait_for_client_timeout,
185
+ configuration_done_timeout=configuration_done_timeout,
186
+ debugpy=debugpy,
187
+ debugpy_wait_for_client=debugpy_wait_for_client,
188
+ debugpy_port=debugpy_port,
189
+ output_messages=output_messages,
190
+ output_log=output_log,
191
+ output_timestamps=output_timestamps,
192
+ group_output=group_output,
195
193
  )
196
194
  )
197
195
 
@@ -1,5 +1,3 @@
1
- from __future__ import annotations
2
-
3
1
  import asyncio
4
2
  import inspect
5
3
  import json
@@ -142,7 +140,7 @@ class DebugAdapterProtocol(JsonRPCProtocolBase):
142
140
  )
143
141
 
144
142
  def _handle_messages(self, iterator: Iterator[ProtocolMessage]) -> None:
145
- def done(f: asyncio.Future[Any]) -> None:
143
+ def done(f: "asyncio.Future[Any]") -> None:
146
144
  ex = f.exception()
147
145
  if ex is not None and not isinstance(ex, asyncio.CancelledError):
148
146
  self._logger.exception(ex, exc_info=ex)
@@ -249,7 +247,7 @@ class DebugAdapterProtocol(JsonRPCProtocolBase):
249
247
 
250
248
  self._received_request[message.seq] = result
251
249
 
252
- def done(t: asyncio.Task[Any]) -> None:
250
+ def done(t: "asyncio.Task[Any]") -> None:
253
251
  try:
254
252
  self.send_response(message.seq, message.command, t.result())
255
253
  except asyncio.CancelledError:
@@ -257,7 +255,6 @@ class DebugAdapterProtocol(JsonRPCProtocolBase):
257
255
  except (SystemExit, KeyboardInterrupt):
258
256
  raise
259
257
  except DebugAdapterRPCErrorException as ex:
260
- self._logger.exception(ex)
261
258
  self.send_error(
262
259
  message=ex.message,
263
260
  request_seq=message.seq,
@@ -321,7 +318,7 @@ class DebugAdapterProtocol(JsonRPCProtocolBase):
321
318
  @_logger.call
322
319
  def send_request_async(
323
320
  self, request: Request, return_type: Optional[Type[TResult]] = None
324
- ) -> asyncio.Future[TResult]:
321
+ ) -> "asyncio.Future[TResult]":
325
322
  return asyncio.wrap_future(self.send_request(request, return_type))
326
323
 
327
324
  @_logger.call
@@ -2,7 +2,8 @@ import asyncio
2
2
  import functools
3
3
  import os
4
4
  import threading
5
- import warnings
5
+ import time
6
+ from concurrent.futures import CancelledError
6
7
  from typing import (
7
8
  TYPE_CHECKING,
8
9
  Callable,
@@ -15,10 +16,7 @@ from typing import (
15
16
 
16
17
  import click
17
18
 
18
- from robotcode.core.async_tools import (
19
- run_coroutine_from_thread_async,
20
- run_coroutine_in_thread,
21
- )
19
+ from robotcode.core.concurrent import run_as_debugpy_hidden_task
22
20
  from robotcode.core.types import ServerMode, TcpParams
23
21
  from robotcode.core.utils.debugpy import (
24
22
  enable_debugpy,
@@ -53,20 +51,22 @@ def set_server(value: "DebugAdapterServer") -> None:
53
51
 
54
52
 
55
53
  @_logger.call
56
- async def wait_for_server(timeout: float = 5) -> "DebugAdapterServer":
57
- async def wait() -> None:
58
- while get_server() is None:
59
- await asyncio.sleep(0.005)
54
+ def wait_for_server(timeout: float = 10) -> "DebugAdapterServer":
60
55
 
61
- await asyncio.wait_for(wait(), timeout)
56
+ start_time = time.monotonic()
57
+ while get_server() is None and time.monotonic() - start_time < timeout:
58
+ time.sleep(0.005)
62
59
 
63
60
  result = get_server()
64
- assert result is not None
61
+
62
+ if result is None:
63
+ raise RuntimeError("Timeout to get server instance.")
64
+
65
65
  return result
66
66
 
67
67
 
68
68
  @_logger.call
69
- async def _debug_adapter_server_(
69
+ async def _debug_adapter_server_async(
70
70
  on_config_done_callback: Optional[Callable[["DebugAdapterServer"], None]],
71
71
  mode: ServerMode,
72
72
  addresses: Union[str, Sequence[str], None],
@@ -89,14 +89,26 @@ async def _debug_adapter_server_(
89
89
  await server.serve()
90
90
 
91
91
 
92
+ def _debug_adapter_server_(
93
+ on_config_done_callback: Optional[Callable[["DebugAdapterServer"], None]],
94
+ mode: ServerMode,
95
+ addresses: Union[str, Sequence[str], None],
96
+ port: int,
97
+ pipe_name: Optional[str],
98
+ ) -> None:
99
+ asyncio.run(_debug_adapter_server_async(on_config_done_callback, mode, addresses, port, pipe_name))
100
+
101
+
92
102
  DEFAULT_TIMEOUT = 10.0
93
103
 
94
104
 
95
105
  config_done_callback: Optional[Callable[["DebugAdapterServer"], None]] = None
106
+ debugpy_connected = threading.Event()
96
107
 
97
108
 
98
109
  @_logger.call
99
- async def start_debugpy_async(
110
+ def start_debugpy(
111
+ app: Application,
100
112
  debugpy_port: Optional[int] = None,
101
113
  addresses: Union[Sequence[str], str, None] = None,
102
114
  wait_for_debugpy_client: bool = False,
@@ -122,17 +134,22 @@ async def start_debugpy_async(
122
134
  )
123
135
 
124
136
  if wait_for_debugpy_client:
125
- wait_for_debugpy_connected()
137
+ app.verbose(f"Wait for debugpy incomming connections listening on {addresses}:{port}")
138
+ if not wait_for_debugpy_connected(wait_for_client_timeout):
139
+ app.warning("No debugpy client connected")
140
+ else:
141
+ app.verbose("Debugpy client connected")
142
+ debugpy_connected.set()
126
143
 
127
144
  config_done_callback = connect_debugpy
128
145
 
129
146
 
130
147
  @_logger.call
131
- async def run_debugger(
148
+ def run_debugger(
132
149
  ctx: click.Context,
133
150
  app: Application,
134
151
  args: List[str],
135
- mode: str,
152
+ mode: ServerMode,
136
153
  addresses: Union[str, Sequence[str], None],
137
154
  port: int,
138
155
  pipe_name: Optional[str] = None,
@@ -150,19 +167,21 @@ async def run_debugger(
150
167
  group_output: bool = False,
151
168
  ) -> int:
152
169
  if debug and debugpy and not is_debugpy_installed():
153
- app.warning("Debugpy not installed.")
170
+ app.warning("Debugpy not installed")
154
171
 
155
172
  if debug and debugpy:
156
- app.verbose("Try to start debugpy session.")
157
- await start_debugpy_async(
173
+ app.verbose("Try to start debugpy session")
174
+ start_debugpy(
175
+ app,
158
176
  debugpy_port,
159
177
  addresses,
160
178
  debugpy_wait_for_client,
161
179
  wait_for_client_timeout,
162
180
  )
163
181
 
164
- app.verbose("Start robotcode debugger thread.")
165
- server_future = run_coroutine_in_thread(
182
+ app.verbose("Start robotcode debugger thread")
183
+
184
+ run_as_debugpy_hidden_task(
166
185
  _debug_adapter_server_,
167
186
  config_done_callback,
168
187
  mode,
@@ -171,41 +190,29 @@ async def run_debugger(
171
190
  pipe_name,
172
191
  )
173
192
 
174
- server = await wait_for_server()
193
+ server = wait_for_server()
194
+
175
195
  exit_code = 255
176
196
 
177
197
  try:
178
198
  if wait_for_client:
179
- app.verbose("Wait for incomming connections.")
199
+ app.verbose("Wait for incomming connections")
180
200
  try:
181
- await run_coroutine_from_thread_async(
182
- server.protocol.wait_for_client,
183
- wait_for_client_timeout,
184
- loop=server.loop,
185
- )
186
- except asyncio.CancelledError:
187
- pass
188
- except asyncio.TimeoutError as e:
189
- raise ConnectionError("No incomming connection from a debugger client.") from e
201
+ server.protocol.wait_for_client(wait_for_client_timeout)
202
+ except TimeoutError as e:
203
+ raise ConnectionError("No incomming connection from a debugger client") from e
190
204
 
191
- await run_coroutine_from_thread_async(server.protocol.wait_for_initialized, loop=server.loop)
205
+ server.protocol.wait_for_initialized(wait_for_client_timeout)
192
206
 
193
207
  if wait_for_client:
194
208
  app.verbose("Wait for debug configuration.")
195
209
  try:
196
- await run_coroutine_from_thread_async(
197
- server.protocol.wait_for_configuration_done,
198
- configuration_done_timeout,
199
- loop=server.loop,
200
- )
201
- except asyncio.CancelledError:
202
- pass
203
- except asyncio.TimeoutError as e:
204
- raise ConnectionError("Timeout to get configuration from client.") from e
210
+ server.protocol.wait_for_configuration_done(configuration_done_timeout)
211
+ except TimeoutError as e:
212
+ raise ConnectionError("Timeout to get configuration from client") from e
205
213
 
206
214
  if debugpy and debugpy_wait_for_client:
207
- app.verbose("Wait for debugpy incomming connections.")
208
- wait_for_debugpy_connected()
215
+ debugpy_connected.wait(wait_for_client_timeout)
209
216
 
210
217
  args = [
211
218
  "--listener",
@@ -225,14 +232,14 @@ async def run_debugger(
225
232
  Debugger.instance().set_main_thread(threading.current_thread())
226
233
  Debugger.instance().server_loop = server.loop
227
234
 
228
- app.verbose("Start the debugger instance.")
235
+ app.verbose("Start the debugger instance")
229
236
  Debugger.instance().start()
230
237
 
231
238
  exit_code = 0
232
239
  try:
233
240
  from robotcode.runner.cli.robot import robot
234
241
 
235
- app.verbose("Start robot.")
242
+ app.verbose("Start robot")
236
243
  try:
237
244
  robot_ctx = robot.make_context("robot", args, parent=ctx)
238
245
  robot.invoke(robot_ctx)
@@ -240,8 +247,7 @@ async def run_debugger(
240
247
  exit_code = cast(int, e.code)
241
248
  finally:
242
249
  if server.protocol.connected:
243
- await run_coroutine_from_thread_async(
244
- server.protocol.send_event_async,
250
+ server.protocol.send_event(
245
251
  Event(
246
252
  event="robotExited",
247
253
  body={
@@ -250,27 +256,19 @@ async def run_debugger(
250
256
  "outputFile": Debugger.instance().robot_output_file,
251
257
  "exitCode": exit_code,
252
258
  },
253
- ),
254
- loop=server.loop,
259
+ )
255
260
  )
256
261
 
257
- await run_coroutine_from_thread_async(server.protocol.exit, exit_code, loop=server.loop)
258
- except asyncio.CancelledError:
262
+ server.protocol.exit(exit_code)
263
+ except CancelledError:
259
264
  pass
260
265
  finally:
261
266
  if server.protocol.connected:
262
- await run_coroutine_from_thread_async(server.protocol.terminate, loop=server.loop)
267
+ server.protocol.terminate()
263
268
 
264
- try:
265
- await run_coroutine_from_thread_async(server.protocol.wait_for_disconnected, loop=server.loop)
266
- except asyncio.TimeoutError:
267
- warnings.warn("Timeout at disconnect client occurred.")
269
+ if not server.protocol.wait_for_disconnected():
270
+ app.warning("Timeout to get disconnected from client")
268
271
 
269
- server_future.cancel()
270
-
271
- try:
272
- await server_future
273
- except asyncio.CancelledError:
274
- pass
272
+ server.loop.stop()
275
273
 
276
274
  return exit_code
@@ -1,8 +1,9 @@
1
1
  import asyncio
2
2
  import os
3
+ import threading
3
4
  from typing import Any, Callable, Dict, List, Literal, Optional, Union
4
5
 
5
- from robotcode.core import async_tools
6
+ from robotcode.core import concurrent
6
7
  from robotcode.core.types import ServerMode, TcpParams
7
8
  from robotcode.core.utils.logging import LoggingDescriptor
8
9
  from robotcode.jsonrpc2.protocol import rpc_method
@@ -59,21 +60,21 @@ class DebugAdapterServerProtocol(DebugAdapterProtocol):
59
60
  def __init__(self) -> None:
60
61
  super().__init__()
61
62
 
62
- self._connected_event = async_tools.Event()
63
- self._disconnected_event = async_tools.Event()
63
+ self._connected_event = threading.Event()
64
+ self._disconnected_event = threading.Event()
64
65
  self._connected = False
65
66
  self._sigint_signaled = False
66
67
 
67
68
  self._initialized = False
68
- self._initialized_event = async_tools.Event()
69
+ self._initialized_event = threading.Event()
69
70
 
70
- self._exited_lock = async_tools.Lock()
71
+ self._exited_lock = concurrent.RLock()
71
72
  self._exited = False
72
73
 
73
- self._terminated_lock = async_tools.Lock()
74
+ self._terminated_lock = concurrent.RLock()
74
75
  self._terminated = False
75
76
 
76
- self._received_configuration_done_event = async_tools.Event()
77
+ self._received_configuration_done_event = threading.Event()
77
78
  self._received_configuration_done = False
78
79
  self.received_configuration_done_callback: Optional[Callable[[], None]] = None
79
80
 
@@ -88,13 +89,13 @@ class DebugAdapterServerProtocol(DebugAdapterProtocol):
88
89
  return self._connected
89
90
 
90
91
  @property
91
- async def exited(self) -> bool:
92
- async with self._exited_lock:
92
+ def exited(self) -> bool:
93
+ with self._exited_lock:
93
94
  return self._exited
94
95
 
95
96
  @property
96
- async def terminated(self) -> bool:
97
- async with self._terminated_lock:
97
+ def terminated(self) -> bool:
98
+ with self._terminated_lock:
98
99
  return self._terminated
99
100
 
100
101
  @_logger.call
@@ -116,22 +117,24 @@ class DebugAdapterServerProtocol(DebugAdapterProtocol):
116
117
  self._disconnected_event.set()
117
118
 
118
119
  @_logger.call
119
- async def wait_for_client(self, timeout: float = 5) -> bool:
120
- await asyncio.wait_for(self._connected_event.wait(), timeout)
120
+ def wait_for_client(self, timeout: float = 5) -> bool:
121
+ if not self._connected_event.wait(timeout):
122
+ raise TimeoutError("Timeout waiting for client")
121
123
 
122
124
  return self._connected
123
125
 
124
126
  @_logger.call
125
- async def wait_for_initialized(self, timeout: float = 30) -> bool:
126
- await asyncio.wait_for(self._initialized_event.wait(), timeout)
127
+ def wait_for_initialized(self, timeout: float = 30) -> bool:
128
+ if not self._initialized_event.wait(timeout):
129
+ raise TimeoutError("Timeout waiting for client initialization")
127
130
 
128
131
  return self._initialized
129
132
 
130
133
  @_logger.call
131
- async def wait_for_disconnected(self, timeout: float = 30) -> bool:
132
- await asyncio.wait_for(self._disconnected_event.wait(), timeout)
134
+ def wait_for_disconnected(self, timeout: float = 5) -> bool:
135
+ self._disconnected_event.wait(timeout)
133
136
 
134
- return self._connected
137
+ return not self._connected
135
138
 
136
139
  @rpc_method(name="initialize", param_type=InitializeRequestArguments)
137
140
  async def _initialize(self, arguments: InitializeRequestArguments, *args: Any, **kwargs: Any) -> Capabilities:
@@ -211,15 +214,15 @@ class DebugAdapterServerProtocol(DebugAdapterProtocol):
211
214
  self._initialized_event.set()
212
215
 
213
216
  @_logger.call
214
- async def exit(self, exit_code: int) -> None:
215
- async with self._exited_lock:
216
- await self.send_event_async(ExitedEvent(body=ExitedEventBody(exit_code=exit_code)))
217
+ def exit(self, exit_code: int) -> None:
218
+ with self._exited_lock:
219
+ self.send_event(ExitedEvent(body=ExitedEventBody(exit_code=exit_code)))
217
220
  self._exited = True
218
221
 
219
222
  @_logger.call
220
- async def terminate(self) -> None:
221
- async with self._terminated_lock:
222
- await self.send_event_async(TerminatedEvent())
223
+ def terminate(self) -> None:
224
+ with self._terminated_lock:
225
+ self.send_event(TerminatedEvent())
223
226
  self._terminated = True
224
227
 
225
228
  @rpc_method(name="terminate", param_type=TerminateArguments)
@@ -251,11 +254,7 @@ class DebugAdapterServerProtocol(DebugAdapterProtocol):
251
254
  *args: Any,
252
255
  **kwargs: Any,
253
256
  ) -> None:
254
- if (
255
- (not (await self.exited) or not (await self.terminated))
256
- and arguments is not None
257
- and arguments.terminate_debuggee
258
- ):
257
+ if (not (self.exited) or not (self.terminated)) and arguments is not None and arguments.terminate_debuggee:
259
258
  os._exit(-1)
260
259
  else:
261
260
  await self.send_event_async(Event("disconnectRequested"))
@@ -290,8 +289,9 @@ class DebugAdapterServerProtocol(DebugAdapterProtocol):
290
289
  self.received_configuration_done_callback()
291
290
 
292
291
  @_logger.call
293
- async def wait_for_configuration_done(self, timeout: float = 5) -> bool:
294
- await asyncio.wait_for(self._received_configuration_done_event.wait(), timeout)
292
+ def wait_for_configuration_done(self, timeout: float = 5) -> bool:
293
+ if not self._received_configuration_done_event.wait(timeout):
294
+ raise TimeoutError("Timeout waiting for configuration done event")
295
295
 
296
296
  return self._received_configuration_done
297
297
 
@@ -1 +0,0 @@
1
- __version__ = "0.80.0"