From d5cf86a81ba8ac370f30dc613029c195f1209811 Mon Sep 17 00:00:00 2001 From: Jason Wilder Date: Sun, 24 Jan 2016 23:04:48 -0700 Subject: [PATCH] Fix panic when tailed file does not exist Fixes #17 --- tail.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tail.go b/tail.go index fa645f1..c74a295 100644 --- a/tail.go +++ b/tail.go @@ -31,7 +31,9 @@ func tailFile(ctx context.Context, file string, poll bool, dest *os.File) { return // get the next log line and echo it out case line := <-t.Lines: - fmt.Fprintln(dest, line.Text) + if line != nil { + fmt.Fprintln(dest, line.Text) + } } } }