MCPcopy Index your code
hub / github.com/loft-sh/devpod / ExecCommand

Method ExecCommand

e2e/framework/exec.go:42–62  ·  view source on GitHub ↗

ExecCommand executes the command string with the devpod test binary

(ctx context.Context, captureStdOut, searchForString bool, searchString string, args []string)

Source from the content-addressed store, hash-verified

40
41// ExecCommand executes the command string with the devpod test binary
42func (f *Framework) ExecCommand(ctx context.Context, captureStdOut, searchForString bool, searchString string, args []string) error {
43 var execOut bytes.Buffer
44
45 cmd := exec.CommandContext(ctx, filepath.Join(f.DevpodBinDir, f.DevpodBinName), args...)
46 cmd.Stdout = io.MultiWriter(os.Stdout, &execOut)
47 cmd.Stderr = os.Stderr
48
49 if err := cmd.Run(); err != nil {
50 return err
51 }
52
53 if captureStdOut && searchForString {
54 if strings.Contains(execOut.String(), searchString) {
55 return nil
56 }
57
58 return fmt.Errorf("expected to find string %s in output", searchString)
59 }
60
61 return nil
62}
63
64// ExecCommandCapture executes the command string with the devpod test binary, and returns stdout, stderr, and any error that occurred.
65func (f *Framework) ExecCommandCapture(ctx context.Context, args []string) (string, string, error) {

Callers 15

DevPodProviderListMethod · 0.95
DevPodProviderUseMethod · 0.95
DevPodStopMethod · 0.95
DevPodProviderAddMethod · 0.95
DevPodProviderDeleteMethod · 0.95
DevPodProviderUpdateMethod · 0.95
DevPodMachineCreateMethod · 0.95
DevPodMachineDeleteMethod · 0.95
DevPodWorkspaceDeleteMethod · 0.95

Calls 3

RunMethod · 0.45
StringMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected