(
guide: string,
commands: string[],
additionalEnvVariables: { [key: string]: string } = {},
)
| 35 | await fs.promises.writeFile(dest, new Uint8Array(body)); |
| 36 | } |
| 37 | |
| 38 | async runShell( |
| 39 | guide: string, |
| 40 | commands: string[], |
| 41 | additionalEnvVariables: { [key: string]: string } = {}, |
| 42 | ): Promise<string> { |
| 43 | let command = ''; |
| 44 | for (const key in additionalEnvVariables) { |
| 45 | command += `export ${key}="${additionalEnvVariables[key] as string}"\n`; |
| 46 | } |
| 47 | command += commands.join(' && '); |
| 48 | console.log(`${wrapInColor(guide, ANSI_COLORS.YELLOW_COLOR)}...`); |
| 49 | for (const command of commands) { |
| 50 | console.log(`- ${command}`); |
| 51 | } |
| 52 | |
| 53 | try { |
| 54 | const result = await spawnCliCommand(command, undefined, 'inherit', false, true); |
| 55 | return result.stdout; |
| 56 | } catch (error) { |
| 57 | // stdio is inherited, so the underlying error message is empty: say what failed instead. |
no test coverage detected