MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / runCodegraph

Function runCodegraph

__tests__/cli-install-init.test.ts:28–52  ·  view source on GitHub ↗

Run the CLI with stdin closed — a prompt that blocks would hang / fail here.

(args: string[], cwd: string)

Source from the content-addressed store, hash-verified

26
27/** Run the CLI with stdin closed — a prompt that blocks would hang / fail here. */
28function runCodegraph(args: string[], cwd: string): RunResult {
29 try {
30 const stdout = execFileSync(process.execPath, [BIN, ...args], {
31 cwd,
32 encoding: 'utf-8',
33 env: {
34 ...process.env,
35 CODEGRAPH_NO_DAEMON: '1',
36 CODEGRAPH_TELEMETRY: '0',
37 DO_NOT_TRACK: '1',
38 NO_COLOR: '1',
39 },
40 stdio: ['ignore', 'pipe', 'pipe'],
41 timeout: 120_000,
42 });
43 return { status: 0, stdout, stderr: '' };
44 } catch (err) {
45 const e = err as { status?: number | null; stdout?: string | Buffer; stderr?: string | Buffer };
46 return {
47 status: e.status ?? -1,
48 stdout: String(e.stdout ?? ''),
49 stderr: String(e.stderr ?? ''),
50 };
51 }
52}
53
54describe('codegraph install --init / init --yes (#1578)', () => {
55 let tempDir: string;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected