mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-12 08:51:53 +00:00
fix(dashboard): suppress unicode-animations postinstall during npm ci
Set CI=1 in _run_npm_install_deterministic so the package's /dev/tty postinstall demo is skipped during hermes dashboard web UI builds. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
743c55efa3
commit
ce99a81123
2 changed files with 23 additions and 2 deletions
|
|
@ -4609,13 +4609,18 @@ def _run_npm_install_deterministic(
|
|||
the working tree dirty and causes the next ``hermes update`` to stash the
|
||||
lockfile — repeatedly.
|
||||
"""
|
||||
# unicode-animations' postinstall animates to /dev/tty (bypasses
|
||||
# --silent/capture_output). It no-ops when CI is set — same as the TUI
|
||||
# install path and nix/lib.nix npm ci hooks.
|
||||
run_env = {**os.environ, **(env or {}), "CI": "1"}
|
||||
|
||||
lockfile = cwd / "package-lock.json"
|
||||
if lockfile.exists():
|
||||
ci_cmd = [npm, "ci", *extra_args]
|
||||
ci_result = subprocess.run(
|
||||
ci_cmd,
|
||||
cwd=cwd,
|
||||
env=env,
|
||||
env=run_env,
|
||||
capture_output=capture_output,
|
||||
text=True,
|
||||
encoding="utf-8",
|
||||
|
|
@ -4630,7 +4635,7 @@ def _run_npm_install_deterministic(
|
|||
return subprocess.run(
|
||||
install_cmd,
|
||||
cwd=cwd,
|
||||
env=env,
|
||||
env=run_env,
|
||||
capture_output=capture_output,
|
||||
text=True,
|
||||
encoding="utf-8",
|
||||
|
|
|
|||
|
|
@ -140,6 +140,22 @@ class TestBuildWebUISkipsWhenFresh:
|
|||
assert kwargs["encoding"] == "utf-8"
|
||||
assert kwargs["errors"] == "replace"
|
||||
|
||||
def test_npm_install_sets_ci_to_suppress_postinstall_tty_output(self, tmp_path):
|
||||
web_dir, _ = _make_web_dir(tmp_path)
|
||||
(web_dir / "package-lock.json").write_text("{}", encoding="utf-8")
|
||||
|
||||
mock_cp = __import__("subprocess").CompletedProcess([], 0, stdout="", stderr="")
|
||||
with patch("hermes_cli.main.subprocess.run", return_value=mock_cp) as mock_run:
|
||||
_run_npm_install_deterministic(
|
||||
"/usr/bin/npm",
|
||||
web_dir,
|
||||
env={"PYTHON": "/nix/store/python"},
|
||||
)
|
||||
|
||||
_, kwargs = mock_run.call_args
|
||||
assert kwargs["env"]["CI"] == "1"
|
||||
assert kwargs["env"]["PYTHON"] == "/nix/store/python"
|
||||
|
||||
def test_npm_install_uses_workspace_web_scope(self, tmp_path):
|
||||
web_dir, _ = _make_web_dir(tmp_path)
|
||||
# Real workspace checkout: the single lockfile lives at the root, so
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue