osbuild/builder: check deferred serve.
Make sure to keep track of the deferred error for serve.
This commit is contained in:
parent
323d3a1f9c
commit
b9b476c430
1 changed files with 17 additions and 5 deletions
|
|
@ -421,12 +421,24 @@ func main() {
|
|||
Host: argBuilderHost,
|
||||
Port: argBuilderPort,
|
||||
}
|
||||
go builder.Serve()
|
||||
|
||||
for state := range builder.StateChannel {
|
||||
if state == StateDone {
|
||||
logrus.Info("main: Shutting down successfully.")
|
||||
os.Exit(ExitOk)
|
||||
errs := make(chan error, 1)
|
||||
|
||||
go func(errs chan<- error) {
|
||||
if err := builder.Serve(); err != nil {
|
||||
errs <- err
|
||||
}
|
||||
}(errs)
|
||||
|
||||
for {
|
||||
select {
|
||||
case state := <-builder.StateChannel:
|
||||
if state == StateDone {
|
||||
logrus.Info("main: Shutting down successfully.")
|
||||
os.Exit(ExitOk)
|
||||
}
|
||||
case err := <-errs:
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue