Skip to content

Commit

Permalink
Fixed an issue with silent hanging when a custom debug server is not …
Browse files Browse the repository at this point in the history
…found // Resolve #3756
  • Loading branch information
ivankravets committed Mar 19, 2021
1 parent 9cca8f3 commit c14b298
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ PlatformIO Core 5
- Boosted `PlatformIO Debugging <https://docs.platformio.org/page/plus/debugging.html>`__ performance thanks to migrating the codebase to the pure Python 3 Asynchronous I/O stack
- Support debugging on Windows using Windows CMD/CLI (`pio debug <https://docs.platformio.org/page/core/userguide/cmd_debug.html>`__) (`issue #3793 <https://github.com/platformio/platformio-core/issues/3793>`_)
- Configure a custom pattern to determine when debugging server is started with a new `debug_server_ready_pattern <https://docs.platformio.org/page/projectconf/section_env_debug.html#debug-server-ready-pattern>`__ option
- Fixed an issue with silent hanging when a custom debug server is not found (`issue #3756 <https://github.com/platformio/platformio-core/issues/3756>`_)

5.1.1 (2021-03-17)
~~~~~~~~~~~~~~~~~~
Expand Down
14 changes: 8 additions & 6 deletions platformio/commands/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ def cli(ctx, project_dir, project_conf, environment, verbose, interface, __unpro
asyncio.set_event_loop(loop)
client = GDBClientProcess(project_dir, debug_config)
coro = client.run(__unprocessed)
loop.run_until_complete(coro)
del client
if IS_WINDOWS:
# an issue with asyncio executor and STIDIN, it cannot be closed gracefully
proc.force_exit()
loop.close()
try:
loop.run_until_complete(coro)
if IS_WINDOWS:
# an issue with asyncio executor and STIDIN, it cannot be closed gracefully
proc.force_exit()
finally:
del client
loop.close()

return True
7 changes: 3 additions & 4 deletions platformio/debug/process/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ async def run(self): # pylint: disable=too-many-branches
server_executable = where_is_program(server_executable)
if not os.path.isfile(server_executable):
raise DebugInvalidOptionsError(
"\nCould not launch Debug Server '%s'. Please check that it "
"is installed and is included in a system PATH\n\n"
"See documentation:\n"
"https://docs.platformio.org/page/plus/debugging.html\n"
"Could not launch Debug Server '%s'. Please check that it "
"is installed and is included in a system PATH\n"
"See https://docs.platformio.org/page/plus/debugging.html"
% server_executable
)

Expand Down

0 comments on commit c14b298

Please sign in to comment.