Skip to content

Commit b965a53

Browse files
committed
fix: stop exit 0 when being called programmatically
1 parent 8e2b94e commit b965a53

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

esptool/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,11 @@ def main(argv: list[str] | None = None, esp: ESPLoader | None = None):
10281028
returned by get_default_connected_device()
10291029
"""
10301030
args = expand_file_arguments(argv or sys.argv[1:])
1031-
cli(args=args, esp=esp)
1031+
try:
1032+
cli(args=args, esp=esp)
1033+
except SystemExit as e:
1034+
if e.code != 0:
1035+
raise
10321036

10331037

10341038
def get_port_list(

0 commit comments

Comments
 (0)