MCPcopy Create free account
hub / github.com/commander-cli/commander / testStdin

Function testStdin

pkg/app/test_command.go:140–155  ·  view source on GitHub ↗
(filters runtime.Filters)

Source from the content-addressed store, hash-verified

138}
139
140func testStdin(filters runtime.Filters) (runtime.Result, error) {
141 f, err := os.Stdin.Stat()
142 if err != nil {
143 return runtime.Result{}, err
144 }
145
146 if (f.Mode() & os.ModeCharDevice) != 0 {
147 return runtime.Result{}, fmt.Errorf("Error: when testing from stdin the command is intended to work with pipes")
148 }
149
150 r := bufio.NewReader(os.Stdin)
151 content, err := ioutil.ReadAll(r)
152 s := suite.ParseYAML(content, "")
153
154 return execute(s, filters)
155}
156
157func execute(s suite.Suite, filters runtime.Filters) (runtime.Result, error) {
158 tests := s.GetTests()

Callers 1

TestCommandFunction · 0.85

Calls 2

ParseYAMLFunction · 0.92
executeFunction · 0.85

Tested by 1

TestCommandFunction · 0.68