Skip to content

Commit

Permalink
Fix issue with waiting on panicing processes hanging forever.
Browse files Browse the repository at this point in the history
This should close #58.
  • Loading branch information
thejerf committed Feb 16, 2022
1 parent 511b0e3 commit 0cef8e8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions v4/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,21 @@ func (s *Supervisor) runService(ctx context.Context, service Service, id service
}()
}

err := service.Serve(childCtx)
cancel()
close(done)
var err error

defer func() {
cancel()
close(done)

r := recover()
if r == nil {
s.serviceEnded(id, err)
} else {
panic(r)
}
}()

s.serviceEnded(id, err)
err = service.Serve(childCtx)
}()
}

Expand Down

0 comments on commit 0cef8e8

Please sign in to comment.