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 json
|
||||||
import re
|
import re
|
||||||
import secrets
|
import secrets
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -168,14 +169,18 @@ def _trigger_rebuild(handle: str) -> None:
|
|||||||
return
|
return
|
||||||
if not _VALID_HANDLE.match(handle):
|
if not _VALID_HANDLE.match(handle):
|
||||||
return # safety: never pass untrusted strings to subprocess
|
return # safety: never pass untrusted strings to subprocess
|
||||||
|
uv = shutil.which("uv") or str(Path.home() / ".local" / "bin" / "uv")
|
||||||
|
try:
|
||||||
subprocess.Popen(
|
subprocess.Popen(
|
||||||
["uv", "run", "bincio", "render",
|
[uv, "run", "bincio", "render",
|
||||||
"--data-dir", str(data_dir),
|
"--data-dir", str(data_dir),
|
||||||
"--site-dir", str(site_dir),
|
"--site-dir", str(site_dir),
|
||||||
"--handle", handle],
|
"--handle", handle],
|
||||||
stdout=subprocess.DEVNULL,
|
stdout=subprocess.DEVNULL,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
)
|
)
|
||||||
|
except Exception:
|
||||||
|
pass # rebuild failure must never 500 the calling endpoint
|
||||||
|
|
||||||
|
|
||||||
# ── Auth endpoints ────────────────────────────────────────────────────────────
|
# ── Auth endpoints ────────────────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user