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

Function run

test/brain-sync.test.ts:33–43  ·  view source on GitHub ↗
(argv: string[], opts: { env?: Record<string, string>; input?: string } = {})

Source from the content-addressed store, hash-verified

31let bareRemote: string;
32
33function run(argv: string[], opts: { env?: Record<string, string>; input?: string } = {}) {
34 const bin = argv[0];
35 const full = bin.startsWith('/') ? bin : path.join(BIN, bin);
36 const res = spawnSync(full, argv.slice(1), {
37 env: { ...process.env, GSTACK_HOME: tmpHome, ...(opts.env || {}) },
38 encoding: 'utf-8',
39 input: opts.input,
40 cwd: ROOT,
41 });
42 return { stdout: res.stdout || '', stderr: res.stderr || '', status: res.status ?? -1 };
43}
44
45function git(args: string[], cwd?: string) {
46 const res = spawnSync('git', args, { cwd: cwd || tmpHome, encoding: 'utf-8' });

Callers 1

brain-sync.test.tsFile · 0.70

Calls 1

spawnSyncFunction · 0.85

Tested by

no test coverage detected