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:
@@ -22,9 +22,13 @@ 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
|
||||
|
||||
# Use --insecure for all network operations (corporate/WSL environments often
|
||||
# have broken CA chains that Go's TLS stack rejects)
|
||||
# Older arduino-cli versions support --insecure for corporate/WSL environments
|
||||
# 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"
|
||||
else
|
||||
ACLI="arduino-cli"
|
||||
fi
|
||||
|
||||
$ACLI core update-index
|
||||
|
||||
|
||||
Reference in New Issue
Block a user