MCPcopy Index your code
hub / github.com/commitdev/zero / executeCmd

Function executeCmd

internal/init/prompts.go:238–250  ·  view source on GitHub ↗
(command string, envVars map[string]string, envVarTranslationMap map[string]string)

Source from the content-addressed store, hash-verified

236}
237
238func executeCmd(command string, envVars map[string]string, envVarTranslationMap map[string]string) string {
239 cmd := exec.Command("bash", "-c", command)
240 // Might need to pass down module's translation map as well,
241 // currently only works in `zero apply`
242 cmd.Env = util.AppendProjectEnvToCmdEnv(envVars, os.Environ(), envVarTranslationMap)
243 out, err := cmd.Output()
244 flog.Debugf("Running command: %s", command)
245 if err != nil {
246 log.Fatalf("Failed to execute %v\n", err)
247 }
248 flog.Debugf("Command result: %s", string(out))
249 return string(out)
250}
251
252// aws cli prints output with linebreak in them
253func sanitizeParameterValue(str string) string {

Callers 1

RunPromptMethod · 0.85

Calls 2

AppendProjectEnvToCmdEnvFunction · 0.92
DebugfFunction · 0.92

Tested by

no test coverage detected