shithub: hugo

Download patch

ref: f94cd2813d074f81fe3e96119e0f6de20aca5729
parent: d1cf262b74e38feb95466a906a5775340024ad95
author: Steve Francia <[email protected]>
date: Thu Jun 2 12:47:28 EDT 2016

Handle errors during rereading properly

Without this fix, any error during rereading would cause Hugo to hang.
Fixes #2168
Closes #2179

--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -505,11 +505,15 @@
 		}
 
 		file, err := s.reReadFile(ev.Name)
+
 		if err != nil {
-			errs <- err
+			jww.ERROR.Println("Error reading file", ev.Name, ";", err)
 		}
 
-		filechan <- file
+		if file != nil {
+			filechan <- file
+		}
+
 	}
 	// we close the filechan as we have sent everything we want to send to it.
 	// this will tell the sourceReaders to stop iterating on that channel
@@ -559,8 +563,8 @@
 
 		return nil
 	}
-	return err
 
+	return err
 }
 
 func (s *Site) Analyze() error {
@@ -835,7 +839,6 @@
 	if err != nil {
 		return nil, err
 	}
-
 	file, err = source.NewFileFromAbs(s.absContentDir(), absFilePath, reader)
 
 	if err != nil {