mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
96800d747b
Signed-off-by: Colin Lacy <colinjlacy@gmail.com>
26 lines
341 B
Go
26 lines
341 B
Go
package exec
|
|
|
|
import (
|
|
"bufio"
|
|
"io"
|
|
"strings"
|
|
)
|
|
|
|
type stdInReader struct {
|
|
Reader io.Reader
|
|
}
|
|
|
|
func (sr *stdInReader) ReadInput() string {
|
|
var lines []string
|
|
in := bufio.NewScanner(sr.Reader)
|
|
for {
|
|
in.Scan()
|
|
line := in.Text()
|
|
if len(line) == 0 {
|
|
break
|
|
}
|
|
lines = append(lines, line)
|
|
}
|
|
return strings.Join(lines, "\n")
|
|
}
|