fix: use shutil.which to find uv in _trigger_rebuild; never 500 on rebuild failure
This commit is contained in:
@@ -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
|
||||
uv = shutil.which("uv") or str(Path.home() / ".local" / "bin" / "uv")
|
||||
try:
|
||||
subprocess.Popen(
|
||||
["uv", "run", "bincio", "render",
|
||||
[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 ────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user