Files
paseo/packages/cli/tests/helpers/local-cli.ts
T
Mohamed Boudra 264276880e fix(daemon): keep lifecycle operations on the selected instance
Restart reconstructed launch inputs and address fallback could redirect a home-selected shutdown to another daemon. Let supervisors publish bound endpoints, retain their worker restart contract, and share captured local lifecycle ownership between CLI and Desktop.
2026-09-09 14:09:53 +02:00

29 lines
813 B
TypeScript

import { $, ProcessPromise } from "zx";
import { join } from "node:path";
import { mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
const cliHome = mkdtempSync(join(tmpdir(), "paseo-test-cli-os-home-"));
process.once("exit", () => rmSync(cliHome, { recursive: true, force: true }));
const CLI_ENTRY = join(import.meta.dirname, "..", "..", "dist", "index.js");
export function runLocalPaseo(
args: string[],
env: NodeJS.ProcessEnv = {},
cwd = process.cwd(),
): ProcessPromise {
$.verbose = false;
return $({
cwd,
env: {
...Object.fromEntries(
Object.entries(process.env).filter(([key]) => !key.startsWith("PASEO_")),
),
...env,
HOME: cliHome,
USERPROFILE: cliHome,
},
})`${process.execPath} ${CLI_ENTRY} ${args}`.nothrow();
}