Prevent the global error collector to panic when sending on closed channel

This commit is contained in:
Bjørn Erik Pedersen
2023-04-13 11:44:22 +02:00
parent 5596dc24a0
commit 9906c1ae52
2 changed files with 12 additions and 6 deletions

View File

@@ -163,12 +163,7 @@ func (h *HugoSites) Build(config BuildCfg, events ...fsnotify.Event) error {
h.Log.Println(b.String())
}
select {
// Make sure the channel always gets something.
case errCollector <- nil:
default:
}
close(errCollector)
h.StopErrorCollector()
err := <-errs
if err != nil {