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

Method RunInteractiveShellRelaxed

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

Source from the content-addressed store, hash-verified

81}
82
83func (z zshTester) RunInteractiveShellRelaxed(t testing.TB, script string) (string, error) {
84 cmd := exec.Command("zsh", "-is")
85 cmd.Stdin = strings.NewReader(script)
86 var stdout bytes.Buffer
87 cmd.Stdout = &stdout
88 var stderr bytes.Buffer
89 cmd.Stderr = &stderr
90 err := cmd.Run()
91 if err != nil {
92 return stdout.String(), fmt.Errorf("unexpected error when running command=%#v, out=%#v, err=%#v: %w", script, stdout.String(), stderr.String(), err)
93 }
94 outStr := stdout.String()
95 require.NotContains(t, outStr, "hishtory fatal error")
96 return outStr, nil
97}
98
99func (z zshTester) RunInteractiveShellBackground(t testing.TB, script string) error {
100 cmd := exec.Command("zsh", "-is")

Callers 5

setupTestTuiFunction · 0.95
TestForceInitFunction · 0.95
TestOfflineClientFunction · 0.95
TestDefaultSearchColumnsFunction · 0.95
RunInteractiveShellMethod · 0.95

Calls 2

RunMethod · 0.80
StringMethod · 0.80

Tested by 4

setupTestTuiFunction · 0.76
TestForceInitFunction · 0.76
TestOfflineClientFunction · 0.76
TestDefaultSearchColumnsFunction · 0.76