Skip to content

Commit 452502f

Browse files
committed
Fix
1 parent 1b4857e commit 452502f

2 files changed

Lines changed: 42 additions & 8 deletions

File tree

editor-backend/app/services/arduino_cli.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,36 @@ def _ensure_board_urls(self):
9797
capture_output=True, text=True
9898
)
9999

100-
# Refresh index so new cores are discoverable
101-
print("[arduino-cli] Updating core index...")
102-
subprocess.run(
100+
# Always refresh the full index so missing/corrupt index files
101+
# are re-downloaded. Log stderr so warnings (like unreachable
102+
# third-party servers) are visible in the container logs.
103+
print("[arduino-cli] Refreshing core indexes...")
104+
result = subprocess.run(
103105
[self.cli_path, "core", "update-index"],
104106
capture_output=True, text=True
105107
)
108+
if result.returncode != 0:
109+
print(f"[arduino-cli] core update-index exited {result.returncode}")
110+
if result.stderr:
111+
print(f"[arduino-cli] stderr: {result.stderr.strip()}")
112+
113+
# Fallback: if the Drazzy index file is still missing, download it
114+
# directly. Some environments have transient DNS / network issues
115+
# and arduino-cli silently skips unavailable indexes.
116+
drazzy_path = Path("/root/.arduino15/package_drazzy.com_index.json")
117+
if not drazzy_path.exists():
118+
print("[arduino-cli] Drazzy index missing — fetching directly...")
119+
import urllib.request
120+
try:
121+
urllib.request.urlretrieve(
122+
"http://drazzy.com/package_drazzy.com_index.json",
123+
str(drazzy_path),
124+
)
125+
print("[arduino-cli] Drazzy index downloaded.")
126+
except Exception as fetch_err:
127+
print(f"[arduino-cli] Direct fetch failed: {fetch_err}")
106128
except Exception as e:
107-
print(f"Warning: Could not configure board URLs: {e}")
129+
print(f"[arduino-cli] Warning: Could not configure board URLs: {e}")
108130

109131
def _ensure_core_installed(self):
110132
"""

src/components/velxio/components/editor/EditorToolbar.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,22 @@ export const EditorToolbar = ({
398398
setCompiling(true);
399399
setMessage(null);
400400
setConsoleOpen(true);
401-
// Wipe the previous build's output before we append anything new.
402-
// Issue #209: lingering logs from prior compiles made it impossible
403-
// to tell the latest errors / warnings apart from stale ones.
404-
setCompileLogs([]);
401+
// Wipe the previous build's output and immediately show a placeholder
402+
// so the console is never blank when it opens.
403+
setCompileLogs([
404+
{
405+
timestamp: new Date(),
406+
type: "info",
407+
message: "Compiling...",
408+
target: activeBoardId
409+
? {
410+
id: activeBoardId,
411+
label: activeBoard ? boardDisplayName(activeBoard) : "Unknown",
412+
kind: "board" as const,
413+
}
414+
: undefined,
415+
},
416+
]);
405417
trackCompileCode();
406418

407419
// ── Custom-chip preparation ─────────────────────────────────────────

0 commit comments

Comments
 (0)