From 5f2d45f63cff6a5a969ee69b484c314075862256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=B8=D0=BB=20=D0=93=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=B0=D1=80=D1=8C?= Date: Fri, 22 May 2026 11:26:34 +1000 Subject: [PATCH] =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5=D1=81=D1=81=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cobot/commands/local_setup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cobot/commands/local_setup.py b/cobot/commands/local_setup.py index ba18dcc..ecfaf14 100644 --- a/cobot/commands/local_setup.py +++ b/cobot/commands/local_setup.py @@ -159,8 +159,9 @@ def _add_ros2_repo(write: Write, on_progress: Optional[Callable[[float], None]] write("[cyan][*][/cyan] Adding ROS2 apt repository...") - # Best-effort update before installing prereqs - subprocess.run(["sudo", "apt-get", "update", "-qq"], capture_output=True) + # Best-effort update - 60 second timeout so a bad mirror doesn't hang forever. + # Фоновое обновление с таймаутом 60 секунд, чтобы зависший зеркальный сервер не блокировал процесс. + subprocess.run(["sudo", "apt-get", "update", "-qq"], capture_output=True, timeout=60) _prog(15) _run_quiet( @@ -176,7 +177,11 @@ def _add_ros2_repo(write: Write, on_progress: Optional[Callable[[float], None]] with tempfile.NamedTemporaryFile(delete=False, suffix=".key") as tmp: tmp_path = tmp.name try: - urllib.request.urlretrieve(_ROS_KEY_URL, tmp_path) + # 30 second timeout - if GitHub is unreachable we fail fast instead of hanging forever. + # Таймаут 30 секунд - если GitHub недоступен, падаем быстро вместо бесконечного зависания. + with urllib.request.urlopen(_ROS_KEY_URL, timeout=30) as resp: + with open(tmp_path, "wb") as f: + f.write(resp.read()) _prog(60) # Convert the ASCII-armored key to binary GPG format that apt understands. # Конвертируем ключ из ASCII-armor формата в бинарный GPG, который понимает apt.