MCPcopy Create free account
hub / github.com/api3dao/airnode / runCommand

Function runCommand

packages/airnode-deployer/src/infrastructure/index.ts:73–95  ·  view source on GitHub ↗
(command: string, options: CommandOptions)

Source from the content-addressed store, hash-verified

71}
72
73export async function runCommand(command: string, options: CommandOptions) {
74 const stringifiedOptions = JSON.stringify(options);
75 const commandSpinner = logger.debugSpinner(`Running command '${command}' with options ${stringifiedOptions}`);
76
77 const goExec = await go(() => exec(command, options));
78 if (!goExec.success) {
79 if (options.ignoreError) {
80 if (logger.inDebugMode()) {
81 logger.getSpinner().info();
82 logger.warn(`Warning: ${goExec.error.message}`);
83 }
84 commandSpinner.warn(`Command '${command}' with options ${stringifiedOptions} failed`);
85 return '';
86 }
87
88 logger.getSpinner().info();
89 commandSpinner.fail(`Command '${command}' with options ${stringifiedOptions} failed`);
90 throw logAndReturnError(goExec.error.toString());
91 }
92
93 commandSpinner.succeed(`Finished command '${command}' with options ${stringifiedOptions}`);
94 return goExec.data.stdout;
95}
96
97export type CommandArg = string | [string, string] | [string, string, string];
98

Callers 1

execTerraformFunction · 0.70

Calls 5

logAndReturnErrorFunction · 0.90
infoMethod · 0.80
warnMethod · 0.80
failMethod · 0.80
succeedMethod · 0.80

Tested by

no test coverage detected