esp-idf/tools
Frantisek Hrbata 75c765ff42 fix: exit gracefully when process started via asyncio is terminated
Currently when process is started through asyncio Runner and it is termited
e.g. with SIGINT(ctrl+c) a traceback is printed instead of gracefully
exit.

Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x7fe980970900>
Traceback (most recent call last):
  File "/usr/lib64/python3.12/asyncio/base_subprocess.py", line 129, in __del__
    self.close()
  File "/usr/lib64/python3.12/asyncio/base_subprocess.py", line 107, in close
    proto.pipe.close()
  File "/usr/lib64/python3.12/asyncio/unix_events.py", line 568, in close
    self._close(None)
  File "/usr/lib64/python3.12/asyncio/unix_events.py", line 592, in _close
    self._loop.call_soon(self._call_connection_lost, exc)
  File "/usr/lib64/python3.12/asyncio/base_events.py", line 793, in call_soon
    self._check_closed()
  File "/usr/lib64/python3.12/asyncio/base_events.py", line 540, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

This is caused because asyncio Runner context in asyncio.run is closing the event
loop and if exception is unhandled in coroutine(run_command) the transport is not
closed before the even loop is closed and we get RuntimeError: Event loop is closed
in the transport __del__ function because it's trying to use the closed
even loop.

Let's catch asyncio.CancelledError in case the process we are trying to
read from is terminated, print message, let the asyncio finish and exit
gracefully.

Closes https://github.com/espressif/esp-idf/issues/13418

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2024-04-04 09:58:01 +02:00
..
ble feat: add requirements.ttfw.txt 2022-08-01 15:52:21 +08:00
catch Whitespace: Automated whitespace fixes (large commit) 2020-11-11 07:36:35 +00:00
ci fix(ci): Simplify and document public header checker 2024-04-04 08:45:15 +02:00
cmake fix: component manager load all component dirs even set(COMPONENTS ...) 2024-03-19 19:52:20 +08:00
docker ci(docker): Added get_idf alias to .bashrc 2024-02-28 10:31:32 +01:00
esp_app_trace fix: Replace deprecated flushregs alias with full gdb command 2023-07-13 09:26:47 +02:00
esp_prov ci: remove ttfw related files 2023-10-16 10:23:09 +02:00
gen_soc_caps_kconfig feat(soc_cap_kconfig): support to search recursively 2024-03-01 10:17:17 +08:00
idf_py_actions fix: exit gracefully when process started via asyncio is terminated 2024-04-04 09:58:01 +02:00
kconfig_new feat(tools/kconfig): add initial and current versions of IDF to kconfig 2023-07-10 17:01:51 +02:00
ldgen feat(esp_system): allow .bss to spill over into L2MEM above 0x4ff40000 2024-02-28 19:41:25 +04:00
mass_mfg fix(tools): replace nvs_partition_gen.py with new esp-idf-nvs-partition-gen package 2023-11-23 23:58:20 +01:00
mocks feat(freertos): Introduced new Kconfig option CONFIG_FREERTOS_NUMBER_OF_CORES 2024-02-09 09:11:28 +01:00
requirements ci: add missing python-gitlab requirement for pytest 2024-01-25 10:12:59 +01:00
templates/sample_component add new command to idf 2020-09-21 23:38:52 +02:00
test_apps fix(esp_hw_support): Fix the flash I/DROM region PMP protection 2024-04-02 18:41:07 +05:30
test_build_system fix: component manager load all component dirs even set(COMPONENTS ...) 2024-03-19 19:52:20 +08:00
test_idf_py feat(tools): Run Tools related host tests on Win 2024-02-02 14:58:04 +01:00
test_idf_tools feat(test_idf_tools): Add tests for esp32p4 for linux and win 2024-03-11 09:33:05 +01:00
test_mkdfu fix(ci): Remove unittest-xml-reporting dependency from host tests 2023-11-30 14:03:41 +01:00
unit-test-app feat(rmt): move the driver to a new component 2023-11-25 00:29:53 +00:00
check_python_dependencies.py fix(tools): catch more general errors in python dependency checker 2024-02-15 10:47:02 +01:00
check_term.py check_term: allow alacritty term 2022-05-19 11:10:59 +08:00
detect_python.fish feat: Drop Python 3.7 support 2023-08-08 08:37:29 +02:00
detect_python.sh feat: Drop Python 3.7 support 2023-08-08 08:37:29 +02:00
eclipse-code-style.xml tools: add code formatter rules for Eclipse 2016-11-03 18:41:00 +08:00
format.sh ci: add astyle pre-commit check 2023-09-27 08:43:45 +02:00
gdb_panic_server.py feat(tools): remove gdb_panic_server and use just a wrapper for script 2023-08-24 15:20:29 +02:00
gen_esp_err_to_name.py fix(err_to_name): restrict gen_esp_err_to_name.py to only search in components/ 2023-11-06 11:41:39 +08:00
generate_debug_prefix_map.py build: create BUILD_DIR/prefix_map_gdbinit when enable reproducible build 2021-10-26 10:55:00 +08:00
idf_monitor.py feat(idf_monitor): move idf_monitor to separate repo 2023-02-03 11:20:15 +01:00
idf_size.py feat(tools): esp_idf_size.ng integration 2023-11-30 09:26:51 +01:00
idf_tools.py refactor(idf_tools): IDF version is acquired only from version or header file 2024-03-19 15:40:45 +01:00
idf.py feat(tools): add 'idf.py qemu' extension 2023-12-03 07:45:19 +01:00
install_util.py ci: remove ttfw related files 2023-10-16 10:23:09 +02:00
mkdfu.py tools: remove the dependency on the future package 2022-08-09 16:46:58 +02:00
mkuf2.py feat(tools): move uf2 generation to esptool 2023-10-09 15:38:30 +02:00
python_version_checker.py feat: Drop Python 3.7 support 2023-08-08 08:37:29 +02:00
requirements_schema.json Tools: Make easier the detection of the list of Python features 2022-02-03 19:02:14 +01:00
requirements.json ci: remove ttfw related files 2023-10-16 10:23:09 +02:00
set-submodules-to-github.sh global: use '/usr/bin/env bash' instead of '/usr/bin/bash' in shebangs 2020-04-03 01:10:02 +02:00
split_paths_by_spaces.py tools: fixup version references related to paths with spaces 2022-05-02 19:05:47 +02:00
tools_schema.json feat(tools): Option in tools.json to rename toolchanis being downloaded 2023-10-17 12:28:02 +02:00
tools.json change(tools/qemu): Update QEMU release versions 2024-03-18 17:05:03 +08:00