Skip to content

Commit d99c972

Browse files
Dzarda7radimkarnis
authored andcommitted
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 espressif#1044
1 parent 12095b2 commit d99c972

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

esptool/loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ def connect(
737737
" if ESP32-C2 doesn't connect"
738738
" (at least 115200 Bd is recommended)."
739739
)
740-
740+
self._port.close()
741741
raise FatalError(
742742
"Failed to connect to {}: {}"
743743
f"{additional_msg}"

0 commit comments

Comments
 (0)