mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-03 12:28:14 -05:00
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
This commit is contained in:
parent
ec02b9908c
commit
68e2e63d92
1 changed files with 4 additions and 3 deletions
|
@ -876,8 +876,11 @@ func (s *Site) ReadPagesFromSource() chan error {
|
||||||
panic(fmt.Sprintf("s.Source not set %s", s.absContentDir()))
|
panic(fmt.Sprintf("s.Source not set %s", s.absContentDir()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errs := make(chan error)
|
||||||
|
|
||||||
if len(s.Source.Files()) < 1 {
|
if len(s.Source.Files()) < 1 {
|
||||||
return nil
|
close(errs)
|
||||||
|
return errs
|
||||||
}
|
}
|
||||||
|
|
||||||
files := s.Source.Files()
|
files := s.Source.Files()
|
||||||
|
@ -891,8 +894,6 @@ func (s *Site) ReadPagesFromSource() chan error {
|
||||||
go sourceReader(s, filechan, results, wg)
|
go sourceReader(s, filechan, results, wg)
|
||||||
}
|
}
|
||||||
|
|
||||||
errs := make(chan error)
|
|
||||||
|
|
||||||
// we can only have exactly one result collator, since it makes changes that
|
// we can only have exactly one result collator, since it makes changes that
|
||||||
// must be synchronized.
|
// must be synchronized.
|
||||||
go readCollator(s, results, errs)
|
go readCollator(s, results, errs)
|
||||||
|
|
Loading…
Reference in a new issue