esptool v5 explicit exists (#23576)

fetch the exit to prevent leaving the running script
This commit is contained in:
Jason2866 2025-06-19 20:19:37 +02:00 committed by GitHub
parent 91e5be450d
commit 25c85a90ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -85,6 +85,17 @@ if not variants_dir:
variants_dir = join(FRAMEWORK_DIR, "variants", "tasmota")
env.BoardConfig().update("build.variants_dir", variants_dir)
def esptool_call(cmd):
try:
esptool.main(cmd)
except SystemExit as e:
# Fetch sys.exit() without leaving the script
if e.code == 0:
return True
else:
print(f"❌ esptool failed with exit code: {e.code}")
return False
def esp32_detect_flashsize():
uploader = env.subst("$UPLOADER")
if not "upload" in COMMAND_LINE_TARGETS:
@ -339,7 +350,7 @@ def esp32_create_combined_bin(source, target, env):
sys.stdout = devnull
sys.stderr = devnull
try:
esptool.main(cmd)
esptool_call(cmd)
finally:
sys.stdout = old_stdout
sys.stderr = old_stderr