MCPcopy Create free account
hub / github.com/garrytan/gstack / runDetect

Function runDetect

test/gbrain-detect-shape.test.ts:41–51  ·  view source on GitHub ↗

* Run detect with a controlled HOME + PATH so the output is deterministic. * We invoke via `bun run ` instead of the shebang so the test doesn't * need bun on its PATH. The script's child-process probes still respect * the controlled PATH.

(env: Partial<NodeJS.ProcessEnv>)

Source from the content-addressed store, hash-verified

39 * the controlled PATH.
40 */
41function runDetect(env: Partial<NodeJS.ProcessEnv>): string {
42 return execFileSync(BUN_BIN, ["run", DETECT_BIN], {
43 encoding: "utf-8",
44 timeout: 15_000,
45 stdio: ["ignore", "pipe", "pipe"],
46 // GBRAIN_HOME pinned empty: detect honors it (codex D11), and sibling
47 // test files in the same shard set it ambiently — without the pin, the
48 // spawned detect reads the polluter's (or the developer's real) config.
49 env: { ...process.env, GBRAIN_HOME: "", ...env },
50 });
51}
52
53/** Run detect with --is-ok and return its exit code (never throws). */
54function runIsOk(env: Partial<NodeJS.ProcessEnv>): number {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected