fix(arduino): probe for --insecure flag before using it

The --insecure global flag was removed in arduino-cli 1.0, causing
the command parser to fail with "unknown command update-index".
Detect support at runtime so the script works with both old and new
versions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
marvin.dietermann
2026-04-10 14:52:23 +02:00
parent 1f42e42bd1
commit 43247d4404

View File

@@ -22,9 +22,13 @@ arduino-cli config add board_manager.additional_urls \
arduino-cli config add board_manager.additional_urls \ arduino-cli config add board_manager.additional_urls \
https://arduino.esp8266.com/stable/package_esp8266com_index.json 2>/dev/null || true https://arduino.esp8266.com/stable/package_esp8266com_index.json 2>/dev/null || true
# Use --insecure for all network operations (corporate/WSL environments often # Older arduino-cli versions support --insecure for corporate/WSL environments
# have broken CA chains that Go's TLS stack rejects) # with broken CA chains. The flag was removed in 1.0, so probe first.
if arduino-cli --insecure version &>/dev/null; then
ACLI="arduino-cli --insecure" ACLI="arduino-cli --insecure"
else
ACLI="arduino-cli"
fi
$ACLI core update-index $ACLI core update-index