MCPcopy Index your code
hub / github.com/coder/coder / runCmd

Function runCmd

testutil/terraform_cache.go:88–99  ·  view source on GitHub ↗
(t *testing.T, dir string, args ...string)

Source from the content-addressed store, hash-verified

86}
87
88func runCmd(t *testing.T, dir string, args ...string) {
89 t.Helper()
90
91 stdout, stderr := bytes.NewBuffer(nil), bytes.NewBuffer(nil)
92 cmd := exec.Command(args[0], args[1:]...) //#nosec
93 cmd.Dir = dir
94 cmd.Stdout = stdout
95 cmd.Stderr = stderr
96 if err := cmd.Run(); err != nil {
97 t.Fatalf("failed to run %s: %s\nstdout: %s\nstderr: %s", strings.Join(args, " "), err, stdout.String(), stderr.String())
98 }
99}
100
101// GetTestTFCacheDir returns a unique cache directory path based on the test name and template files.
102// Each test gets a unique cache dir based on its name and template files.

Callers 1

DownloadTFProvidersFunction · 0.70

Calls 5

CommandMethod · 0.80
HelperMethod · 0.65
RunMethod · 0.65
FatalfMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected