From 43247d440401482772f6541309497651e60ddda8 Mon Sep 17 00:00:00 2001 From: "marvin.dietermann" Date: Fri, 10 Apr 2026 14:52:23 +0200 Subject: [PATCH] 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 --- lib/arduino.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/arduino.sh b/lib/arduino.sh index 4efe8b4..8e7e274 100644 --- a/lib/arduino.sh +++ b/lib/arduino.sh @@ -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) -ACLI="arduino-cli --insecure" +# 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