mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 16:34:36 +00:00
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.
29 lines
813 B
TypeScript
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();
|
|
}
|