From 70420c456ee8c30c4159bed71cc228e15e02803b Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Mon, 31 Dec 2018 15:05:13 +0100 Subject: [PATCH] Handle empty mailqueue gracefully, it is not an error --- parser/parser.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser/parser.go b/parser/parser.go index 901813b..d675c79 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -52,7 +52,7 @@ func ParseMailQ(dataSource io.Reader) ([]QEntry, error) { line = scanner.Text() if strings.HasPrefix(line, "Mail queue is empty") { // If mail queue is empty, there is nothing to do - return nil, errors.New(line) + return []QEntry{}, nil } else if strings.HasPrefix(line, "-Queue ID-") == false { // Abort if input does not look like output from mailq(1) return nil, errors.New("Sorry, this does not look like output from mailq(1).")