captureInput captures the input for a function call
(input string)
| 287 | |
| 288 | // captureInput captures the input for a function call |
| 289 | func captureInput(input string) func() { |
| 290 | r, w, _ := os.Pipe() |
| 291 | _, _ = w.WriteString(input) |
| 292 | _ = w.Close() |
| 293 | stdin := os.Stdin |
| 294 | os.Stdin = r |
| 295 | return func() { |
| 296 | os.Stdin = stdin |
| 297 | } |
| 298 | } |
no test coverage detected