MCPcopy
hub / github.com/ddworken/hishtory / RunInteractiveShellRelaxed

Method RunInteractiveShellRelaxed

client/testutils.go:45–59  ·  view source on GitHub ↗
(t testing.TB, script string)

Source from the content-addressed store, hash-verified

43}
44
45func (b bashTester) RunInteractiveShellRelaxed(t testing.TB, script string) (string, error) {
46 cmd := exec.Command("bash", "-i")
47 cmd.Stdin = strings.NewReader(script)
48 var stdout bytes.Buffer
49 cmd.Stdout = &stdout
50 var stderr bytes.Buffer
51 cmd.Stderr = &stderr
52 err := cmd.Run()
53 if err != nil {
54 return "", fmt.Errorf("unexpected error when running commands, out=%#v, err=%#v: %w", stdout.String(), stderr.String(), err)
55 }
56 outStr := stdout.String()
57 require.NotContains(t, outStr, "hishtory fatal error", "Ran command, but hishtory had a fatal error!")
58 return outStr, nil
59}
60
61func (b bashTester) RunInteractiveShellBackground(t testing.TB, script string) error {
62 cmd := exec.Command("bash", "-i")

Callers 1

RunInteractiveShellMethod · 0.95

Calls 2

RunMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected