MCPcopy Index your code
hub / github.com/coder/envbox / execContainerCmd

Function execContainerCmd

integration/gpu_test.go:291–305  ·  view source on GitHub ↗
(ctx context.Context, t *testing.T, containerID string, cmdArgs ...string)

Source from the content-addressed store, hash-verified

289}
290
291func execContainerCmd(ctx context.Context, t *testing.T, containerID string, cmdArgs ...string) (string, error) {
292 t.Helper()
293
294 execArgs := []string{"exec", containerID}
295 execArgs = append(execArgs, cmdArgs...)
296 t.Logf("exec cmd: docker %s", strings.Join(execArgs, " "))
297 execCmd := exec.CommandContext(ctx, "docker", execArgs...)
298 out, err := execCmd.CombinedOutput()
299 if err != nil {
300 t.Logf("exec cmd failed: %s\n%s", err.Error(), string(out))
301 } else {
302 t.Logf("exec cmd success: %s", out)
303 }
304 return strings.TrimSpace(string(out)), err
305}

Callers 4

TestDocker_NvidiaFunction · 0.85
outerFilesFunction · 0.85
assertInnerFilesFunction · 0.85
assertInnerNvidiaSMIFunction · 0.85

Calls 3

CombinedOutputMethod · 0.80
CommandContextMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected