From 9d3094c1fe41b30b3e0b739740e272e336611b43 Mon Sep 17 00:00:00 2001 From: Steven Powell <44844360+spowelljr@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:30:21 -0700 Subject: [PATCH] Fix long lines in lastStart.txt not outputting in log outputs (#19740) --- pkg/minikube/logs/logs.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkg/minikube/logs/logs.go b/pkg/minikube/logs/logs.go index bcb3f4b13f2d..c54ce8da6767 100644 --- a/pkg/minikube/logs/logs.go +++ b/pkg/minikube/logs/logs.go @@ -234,15 +234,21 @@ func OutputLastStart() error { } defer f.Close() l := "" - s := bufio.NewScanner(f) - for s.Scan() { - l += s.Text() + "\n" + r := bufio.NewReader(f) + var s string + for { + s, err = r.ReadString('\n') + if err != nil { + break + } + l += s } out.Styled(style.None, l) - if err := s.Err(); err != nil { - return fmt.Errorf("failed to read file %s: %v", fp, err) + if err == io.EOF { + return nil } - return nil + + return fmt.Errorf("failed to read file %s: %v", fp, err) } // OutputOffline outputs logs that don't need a running cluster.