Exit -1 on ERROR in non-global logger
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 27 Mar 2017 08:55:29 +0000 (10:55 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 27 Mar 2017 08:55:29 +0000 (10:55 +0200)
Fixes #3239

main.go

diff --git a/main.go b/main.go
index 25b0f6e866578fbe1dd41792a912496b87c4ef76..189cac43e3c795f800f98b274715f41945b9564d 100644 (file)
--- a/main.go
+++ b/main.go
@@ -16,9 +16,10 @@ package main
 import (
        "runtime"
 
+       "os"
+
        "github.com/spf13/hugo/commands"
        jww "github.com/spf13/jwalterweatherman"
-       "os"
 )
 
 func main() {
@@ -28,4 +29,10 @@ func main() {
        if jww.LogCountForLevelsGreaterThanorEqualTo(jww.LevelError) > 0 {
                os.Exit(-1)
        }
+
+       if commands.Hugo != nil {
+               if commands.Hugo.Log.LogCountForLevelsGreaterThanorEqualTo(jww.LevelError) > 0 {
+                       os.Exit(-1)
+               }
+       }
 }