mirror of
https://github.com/espressif/esptool.git
synced 2025-10-15 21:07:25 +08:00
fix: close port when connect fails
This fixes a bug where the serial port is not closed when the connect fails. This can cause the port to be left open and unusable. This occurs when esptool is used as a module and detect_chip is called. Closes https://github.com/espressif/esptool/issues/1044
This commit is contained in:

committed by
Radim Karniš

parent
12095b2b31
commit
d99c972156
@@ -737,7 +737,7 @@ class ESPLoader(object):
|
||||
" if ESP32-C2 doesn't connect"
|
||||
" (at least 115200 Bd is recommended)."
|
||||
)
|
||||
|
||||
self._port.close()
|
||||
raise FatalError(
|
||||
"Failed to connect to {}: {}"
|
||||
f"{additional_msg}"
|
||||
|
Reference in New Issue
Block a user