diff --git a/go/src/fullcycle/analog-kernel/main.go b/go/src/fullcycle/analog-kernel/main.go index c7400c5..ecb5ae4 100644 --- a/go/src/fullcycle/analog-kernel/main.go +++ b/go/src/fullcycle/analog-kernel/main.go @@ -4,9 +4,11 @@ import ( "bufio" "encoding/json" "fmt" + "io" "io/ioutil" "log" "os" + "strings" "fullcycle/analog-kernel/parser" ) @@ -82,13 +84,24 @@ func main() { check(err) // Read stdin. - s := bufio.NewScanner(os.Stdin) - for s.Scan() { - if l := s.Text(); l == "end of kernel" { + stdin := bufio.NewReader(os.Stdin) + for { + s, err := stdin.ReadString('\n') + if err != nil { + if err != io.EOF { + log.Fatal(err) + break + } + + continue + } + + s = strings.Trim(s, "\r\n") + if s == "end of kernel" { break - } else { - r.Log = append(r.Log, l) } + + r.Log = append(r.Log, s) } // Parse.