hugolib: Fix error handling in page collector
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 2 Mar 2020 10:07:09 +0000 (11:07 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 2 Mar 2020 10:07:09 +0000 (11:07 +0100)
Fixes #6988

hugolib/pages_capture.go

index de7ccb0845a12548524532afc7847adbda564d66..020e243c5058786568e2737ed46f2e3cca4104e7 100644 (file)
@@ -158,7 +158,10 @@ func (c *pagesCollector) isCascadingEdit(dir contentDirKey) (bool, string) {
 func (c *pagesCollector) Collect() (collectErr error) {
        c.proc.Start(context.Background())
        defer func() {
-               collectErr = c.proc.Wait()
+               err := c.proc.Wait()
+               if collectErr == nil {
+                       collectErr = err
+               }
        }()
 
        if len(c.filenames) == 0 {