Skip to content

Commit 5463bee

Browse files
authored
add timeout when request for framework lib fails
1 parent 99dbcfa commit 5463bee

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

platform.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ def _run_idf_tools_install(self, tools_json_path: str, idf_tools_path: str) -> b
167167
cmd,
168168
stdout=subprocess.DEVNULL,
169169
stderr=subprocess.DEVNULL,
170-
timeout=SUBPROCESS_TIMEOUT
170+
timeout=SUBPROCESS_TIMEOUT,
171+
check=False
171172
)
172173

173174
if result.returncode != 0:
@@ -277,9 +278,14 @@ def _configure_arduino_framework(self, frameworks: List[str]) -> None:
277278
self.packages["framework-arduinoespressif32-libs"]["optional"] = False
278279
# use branch master
279280
URL = "https://raw.githubusercontent.com/espressif/arduino-esp32/master/package/package_esp32_index.template.json"
280-
packjdata = requests.get(URL).json()
281-
dyn_lib_url = packjdata['packages'][0]['tools'][0]['systems'][0]['url']
282-
self.packages["framework-arduinoespressif32-libs"]["version"] = dyn_lib_url
281+
try:
282+
response = requests.get(URL, timeout=30)
283+
response.raise_for_status()
284+
packjdata = response.json()
285+
dyn_lib_url = packjdata['packages'][0]['tools'][0]['systems'][0]['url']
286+
self.packages["framework-arduinoespressif32-libs"]["version"] = dyn_lib_url
287+
except (requests.RequestException, KeyError, IndexError) as e:
288+
logger.error(f"Failed to fetch Arduino framework library URL: {e}")
283289

284290
def _configure_espidf_framework(self, frameworks: List[str], variables: Dict, board_config: Dict, mcu: str) -> None:
285291
"""Configure ESP-IDF framework"""

0 commit comments

Comments
 (0)