syft/internal/ui/logger_output.go
Alex Goodman 7ebb9f4e0b
Add check for app update (#88)
* add check for app update; fix ETUI error handling

* validate user args
2020-07-21 12:02:03 -04:00

40 lines
839 B
Go

package ui
import (
imgbomEvent "github.com/anchore/imgbom/imgbom/event"
"github.com/anchore/imgbom/internal/log"
"github.com/anchore/imgbom/internal/ui/common"
"github.com/wagoodman/go-partybus"
)
func LoggerUI(workerErrs <-chan error, subscription *partybus.Subscription) error {
events := subscription.Events()
eventLoop:
for {
select {
case err := <-workerErrs:
if err != nil {
return err
}
case e, ok := <-events:
if !ok {
// event bus closed...
break eventLoop
}
// ignore all events except for the final event
if e.Type == imgbomEvent.CatalogerFinished {
err := common.CatalogerFinishedHandler(e)
if err != nil {
log.Errorf("unable to show catalog image finished event: %+v", err)
}
// this is the last expected event
break eventLoop
}
}
}
return nil
}