MCPcopy
hub / github.com/garrytan/gstack / runLibSnippet

Function runLibSnippet

test/gbrain-lib-verify.test.ts:41–52  ·  view source on GitHub ↗
(snippet: string, stdin: string = '')

Source from the content-addressed store, hash-verified

39// Invoke a bash snippet that sources the lib and runs something against it.
40// Returns stdout + stderr + exit code. Stdin is piped so [ -t 0 ] = false.
41function runLibSnippet(snippet: string, stdin: string = '') {
42 const script = `set -euo pipefail\n. ${JSON.stringify(LIB)}\n${snippet}`;
43 const res = spawnSync('bash', ['-c', script], {
44 input: stdin,
45 encoding: 'utf-8',
46 });
47 return {
48 stdout: (res.stdout || '').trim(),
49 stderr: (res.stderr || '').trim(),
50 status: res.status ?? -1,
51 };
52}
53
54describe('gstack-gbrain-supabase-verify', () => {
55 const VALID =

Callers 1

Calls 1

spawnSyncFunction · 0.85

Tested by

no test coverage detected