Handle empty mailqueue gracefully, it is not an error
This commit is contained in:
parent
6a934ee54b
commit
70420c456e
|
@ -52,7 +52,7 @@ func ParseMailQ(dataSource io.Reader) ([]QEntry, error) {
|
||||||
line = scanner.Text()
|
line = scanner.Text()
|
||||||
if strings.HasPrefix(line, "Mail queue is empty") {
|
if strings.HasPrefix(line, "Mail queue is empty") {
|
||||||
// If mail queue is empty, there is nothing to do
|
// 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 {
|
} else if strings.HasPrefix(line, "-Queue ID-") == false {
|
||||||
// Abort if input does not look like output from mailq(1)
|
// 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).")
|
return nil, errors.New("Sorry, this does not look like output from mailq(1).")
|
||||||
|
|
Loading…
Reference in New Issue