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

Function run

test/gstack-paths.test.ts:18–32  ·  view source on GitHub ↗
(env: Record<string, string | undefined>)

Source from the content-addressed store, hash-verified

16// silently breaks the "HOME unset" test scenarios. Clearing USERPROFILE
17// alongside HOME prevents that auto-population on Windows runners.
18function run(env: Record<string, string | undefined>): Record<string, string> {
19 const result = spawnSync('bash', [BIN], {
20 env: { PATH: process.env.PATH, USERPROFILE: '', ...env } as Record<string, string>,
21 encoding: 'utf-8',
22 });
23 if (result.status !== 0) {
24 throw new Error(`gstack-paths failed (status ${result.status}): ${result.stderr}`);
25 }
26 const out: Record<string, string> = {};
27 for (const line of result.stdout.split('\n')) {
28 const eq = line.indexOf('=');
29 if (eq > 0) out[line.slice(0, eq)] = line.slice(eq + 1);
30 }
31 return out;
32}
33
34describe('gstack-paths', () => {
35 test('GSTACK_HOME wins over CLAUDE_PLUGIN_DATA and HOME', () => {

Callers 1

Calls 1

spawnSyncFunction · 0.85

Tested by

no test coverage detected