fix: harden cross-platform paths and child-process handling

Replace process.env.HOME fallbacks with os.homedir() in dashboard usage
probes and the hermes plugin profile resolver so unset HOME no longer
yields literal "~" paths. Skip POSIX process-group semantics on Windows
in engine/merger and dashboard-tui's pgrep-based vitest killer. Add
shell: true to npx spawns in CLI skills/extension so .cmd shims resolve
on Windows, and route test:build-exe through cross-env.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-27 23:27:27 -07:00
parent 02d68f945d
commit 2229815bad
8 changed files with 41 additions and 11 deletions

View File

@@ -12,7 +12,8 @@
*/
import { spawn, spawnSync } from "node:child_process";
import { sep as PATH_SEP } from "node:path";
import os from "node:os";
import path, { sep as PATH_SEP } from "node:path";
/**
* On Windows, `spawn("hermes", ...)` won't find `hermes.cmd`/`.bat` shims —
@@ -143,9 +144,9 @@ function parseProfileListOutput(raw: string): HermesProfileSummary[] {
* This is used to set HERMES_HOME when spawning hermes with a specific profile.
*/
function hermesProfileHome(profileName: string): string {
const base = process.env.HERMES_HOME ?? `${process.env.HOME ?? "~"}/.hermes`;
const base = process.env.HERMES_HOME ?? path.join(os.homedir(), ".hermes");
if (profileName === "default" || profileName === "") return base;
return `${base}/profiles/${profileName}`;
return path.join(base, "profiles", profileName);
}
/**