From 7266b6cd148df1ab6823f7c4f6ffbf2ab765b6d1 Mon Sep 17 00:00:00 2001 From: Nick Mitchell Date: Tue, 24 Sep 2024 13:18:08 -0400 Subject: [PATCH] fix: local backend segfaults with `up --verbose` We were passing Logger=nil to the Tail package, which is what its docs state will result in using its default logger. Unfortunately we rather see a null pointer segfault. Signed-off-by: Nick Mitchell --- pkg/be/local/streamer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/be/local/streamer.go b/pkg/be/local/streamer.go index 37f545af3..161174af3 100644 --- a/pkg/be/local/streamer.go +++ b/pkg/be/local/streamer.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "log" "os" "path/filepath" "strings" @@ -253,8 +254,7 @@ func (s localStreamer) ComponentLogs(c lunchpail.Component, opts streamer.LogOpt func tailfChan(outfile string, opts streamer.LogOptions) (*tail.Tail, error) { Logger := tail.DiscardingLogger if opts.Verbose { - // this tells tailf to use its default logger - Logger = nil + Logger = log.New(os.Stderr, "", log.LstdFlags) } return tail.TailFile(outfile, tail.Config{Follow: opts.Follow, ReOpen: opts.Follow, Logger: Logger})