Handle empty mailqueue gracefully, it is not an error

This commit is contained in:
Jan Philipp Timme 2018-12-31 15:05:13 +01:00
parent 6a934ee54b
commit 70420c456e
1 changed files with 1 additions and 1 deletions

View File

@ -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).")