fix(windows): prefer managed npm for hermes update desktop-rebuild gate

The `hermes update` desktop-rebuild gate still used a bare
`shutil.which("npm")` presence check. On a Windows box where the only
working npm is the Hermes-managed npm.cmd (not on PATH), the gate would
skip the desktop rebuild even though _build_web_ui / cmd_gui can now find
it via find_node_executable. Route the gate through the same resolver for
full bug-class coverage.

Surfaced during review of #49239.
This commit is contained in:
kshitijk4poor 2026-06-20 02:01:24 +05:30
parent 7a7b56d498
commit fcc169057d

View file

@ -9043,7 +9043,9 @@ def _cmd_update_impl(args, gateway_mode: bool):
# Electron build by ``hermes update``.
desktop_dir = PROJECT_ROOT / "apps" / "desktop"
has_desktop_app = _desktop_packaged_executable(desktop_dir) is not None or _desktop_dist_exists(desktop_dir)
if (desktop_dir / "package.json").exists() and shutil.which("npm") and has_desktop_app:
from hermes_constants import find_node_executable
if (desktop_dir / "package.json").exists() and find_node_executable("npm") and has_desktop_app:
print("→ Checking if desktop app needs rebuilding...")
_desktop_build_cmd = [sys.executable, "-m", "hermes_cli.main", "desktop", "--build-only"]
# Stream the build output live (long Electron builds otherwise