mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Handle errors during rereading properly
Without this fix, any error during rereading would cause Hugo to hang. Fixes #2168 Closes #2179
This commit is contained in:
parent
d1cf262b74
commit
f94cd2813d
1 changed files with 7 additions and 4 deletions
|
@ -505,11 +505,15 @@ func (s *Site) ReBuild(events []fsnotify.Event) error {
|
|||
}
|
||||
|
||||
file, err := s.reReadFile(ev.Name)
|
||||
|
||||
if err != nil {
|
||||
errs <- err
|
||||
jww.ERROR.Println("Error reading file", ev.Name, ";", err)
|
||||
}
|
||||
|
||||
if file != nil {
|
||||
filechan <- file
|
||||
}
|
||||
|
||||
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 @@ func (s *Site) ReBuild(events []fsnotify.Event) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *Site) Analyze() error {
|
||||
|
@ -835,7 +839,6 @@ func (s *Site) reReadFile(absFilePath string) (*source.File, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
file, err = source.NewFileFromAbs(s.absContentDir(), absFilePath, reader)
|
||||
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue