fix: use shutil.which to find uv in _trigger_rebuild; never 500 on rebuild failure

This commit is contained in:
Davide Scaini
2026-04-10 15:33:06 +02:00
parent 7088b94a87
commit 8d8b009a78
+13 -8
View File
@@ -11,6 +11,7 @@ from __future__ import annotations
import json
import re
import secrets
import shutil
import subprocess
import time
from pathlib import Path
@@ -168,14 +169,18 @@ def _trigger_rebuild(handle: str) -> None:
return
if not _VALID_HANDLE.match(handle):
return # safety: never pass untrusted strings to subprocess
subprocess.Popen(
["uv", "run", "bincio", "render",
"--data-dir", str(data_dir),
"--site-dir", str(site_dir),
"--handle", handle],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
uv = shutil.which("uv") or str(Path.home() / ".local" / "bin" / "uv")
try:
subprocess.Popen(
[uv, "run", "bincio", "render",
"--data-dir", str(data_dir),
"--site-dir", str(site_dir),
"--handle", handle],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
except Exception:
pass # rebuild failure must never 500 the calling endpoint
# ── Auth endpoints ────────────────────────────────────────────────────────────