shithub: hugo

Download patch

ref: 68e2e63d92d238ad9b8a714acd2467bb43122ada
parent: ec02b9908cef4f4e022d9bd207c64a3ca086b57a
author: Tatsushi Demachi <[email protected]>
date: Sun Jan 31 19:21:12 EST 2016

Fix Hugo hang up with empty content directory

Site.ReadPagesFromSource returns nil chan error value when a site
content directory is empty but its receiver expects to be passed
something error values via the channel.

This fixes it by returning a channel which will be immediately closed.

Fix #1797

--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -876,8 +876,11 @@
 		panic(fmt.Sprintf("s.Source not set %s", s.absContentDir()))
 	}
 
+	errs := make(chan error)
+
 	if len(s.Source.Files()) < 1 {
-		return nil
+		close(errs)
+		return errs
 	}
 
 	files := s.Source.Files()
@@ -890,8 +893,6 @@
 	for i := 0; i < procs*4; i++ {
 		go sourceReader(s, filechan, results, wg)
 	}
-
-	errs := make(chan error)
 
 	// we can only have exactly one result collator, since it makes changes that
 	// must be synchronized.