MCPcopy Create free account
hub / github.com/Snapchat/Valdi / runShell

Method runShell

npm_modules/cli/src/setup/DevSetupHelper.ts:37–54  ·  view source on GitHub ↗
(
    guide: string,
    commands: string[],
    additionalEnvVariables: { [key: string]: string } = {},
  )

Source from the content-addressed store, hash-verified

35 }
36
37 async runShell(
38 guide: string,
39 commands: string[],
40 additionalEnvVariables: { [key: string]: string } = {},
41 ): Promise<string> {
42 let command = '';
43 for (const key in additionalEnvVariables) {
44 command += `export ${key}="${additionalEnvVariables[key] as string}"\n`;
45 }
46 command += commands.join(' && ');
47 console.log(`${wrapInColor(guide, ANSI_COLORS.YELLOW_COLOR)}...`);
48 for (const command of commands) {
49 console.log(`- ${command}`);
50 }
51
52 const result = await spawnCliCommand(command, undefined, 'inherit', false, true);
53 return result.stdout;
54 }
55
56 async writeEnvVariablesToRcFile(envVariables: readonly EnvVariable[]): Promise<void> {
57 const expectedEnvVariable = envVariables.map(e => `export ${e.name}=${e.value}`);

Callers 2

macOSSetupFunction · 0.95
linuxSetupFunction · 0.95

Calls 4

wrapInColorFunction · 0.90
spawnCliCommandFunction · 0.90
logMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected