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

Function shell

__tests__/bundle-launcher.test.ts:19–30  ·  view source on GitHub ↗
(script: string, args: string[] = [], extraEnv: NodeJS.ProcessEnv = {}, input?: string)

Source from the content-addressed store, hash-verified

17const env = { ...process.env, CODEGRAPH_TELEMETRY: '0', DO_NOT_TRACK: '1', CODEGRAPH_NO_PROMPT_HOOK: '1' };
18
19function shell(script: string, args: string[] = [], extraEnv: NodeJS.ProcessEnv = {}, input?: string) {
20 // A file avoids Windows command-line quoting altering the recipe's printf
21 // escapes or our argument fixtures before Bash even reads them.
22 const root = fs.mkdtempSync(path.join(os.tmpdir(), 'codegraph-shell-'));
23 roots.push(root);
24 const file = path.join(root, 'test.sh');
25 const quote = (value: string) => "'" + value.replace(/'/g, "'\\''") + "'";
26 fs.writeFileSync(file, `set -- ${args.map(quote).join(' ')}\n${script}`);
27 return spawnSync(bash, ['--noprofile', '--norc', file], {
28 encoding: 'utf8', timeout: 30_000, env: { ...env, ...extraEnv }, input,
29 });
30}
31
32function stage(osfam = windows ? 'win32' : process.platform) {
33 const root = fs.mkdtempSync(path.join(os.tmpdir(), 'codegraph bundle space '));

Callers 4

stageFunction · 0.85
invokeFunction · 0.85
downloadFunction · 0.85

Calls 3

pushMethod · 0.80
mapMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected