Download test/cli-json-stdout.test-support.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 835 Bytes
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/test/cli-json-stdout.test-support.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/test/cli-json-stdout.test-support.ts
-
curl -L -o cli-json-stdout.test-support.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/test/cli-json-stdout.test-support.ts
835 Bytes
| import { spawnSync } from "node:child_process"; | |
| import path from "node:path"; | |
| export function runBuiltCli( | |
| tempHome: string, | |
| args: string[], | |
| envOverrides: NodeJS.ProcessEnv = {}, | |
| options: { inheritEnvironment?: boolean } = {}, | |
| ) { | |
| const env: NodeJS.ProcessEnv = { | |
| ...(options.inheritEnvironment === false ? { PATH: process.env.PATH } : process.env), | |
| HOME: tempHome, | |
| USERPROFILE: tempHome, | |
| OPENCLAW_TEST_FAST: "1", | |
| }; | |
| delete env.OPENCLAW_HOME; | |
| delete env.OPENCLAW_STATE_DIR; | |
| delete env.OPENCLAW_CONFIG_PATH; | |
| delete env.VITEST; | |
| Object.assign(env, envOverrides); | |
| const entry = path.resolve(process.cwd(), "openclaw.mjs"); | |
| return spawnSync(process.execPath, [entry, ...args], { | |
| cwd: process.cwd(), | |
| env, | |
| encoding: "utf8", | |
| maxBuffer: 10 * 1024 * 1024, | |
| timeout: 60_000, | |
| }); | |
| } | |