mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 11:55:47 -06:00
fix(update): keep TUI lock resolver private
This commit is contained in:
@@ -2,18 +2,11 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
listLocalTuiProcesses,
|
||||
quiesceLocalTuiProcessesBeforeUpdate,
|
||||
resolveLocalTuiUpdateLockPath,
|
||||
terminateLocalTuiProcesses,
|
||||
waitForLocalTuiUpdate,
|
||||
} from "./local-tui-processes.js";
|
||||
|
||||
describe("local TUI processes", () => {
|
||||
it("scopes the update gate to the invoking user's home", () => {
|
||||
expect(resolveLocalTuiUpdateLockPath("/home/alice")).not.toBe(
|
||||
resolveLocalTuiUpdateLockPath("/home/bob"),
|
||||
);
|
||||
});
|
||||
|
||||
it("lists only verified local TUI processes from ps output", () => {
|
||||
const spawnSync = vi.fn().mockReturnValue({
|
||||
status: 0,
|
||||
|
||||
@@ -30,7 +30,7 @@ type PsResult = {
|
||||
|
||||
const LOCAL_TUI_SUBCOMMANDS = new Set(["chat", "terminal", "tui"]);
|
||||
const LOCAL_TUI_PROCESS_PROBE_TIMEOUT_MS = 1_000;
|
||||
export function resolveLocalTuiUpdateLockPath(userHome = os.homedir()): string {
|
||||
function resolveLocalTuiUpdateLockPath(userHome = os.homedir()): string {
|
||||
const ownerScope = createHash("sha256").update(userHome).digest("hex").slice(0, 16);
|
||||
return path.join(os.tmpdir(), `openclaw-local-tui-update-${ownerScope}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user