mirror of
https://github.com/containers/podman.git
synced 2025-06-28 14:29:04 +08:00
Enforce LIFO ordering for shutdown handlers
This allows us to run both the Libpod and Server handlers at the same time without unregistering one. Also, pass the signal that killed us into the handlers, in case they want to use it to determine what to do (e.g. what exit code to set). Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
@ -185,14 +185,11 @@ func (s *APIServer) Serve() error {
|
||||
if err := shutdown.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := shutdown.Register("server", func() error {
|
||||
if err := shutdown.Register("server", func(sig os.Signal) error {
|
||||
return s.Shutdown()
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
// Unregister the libpod handler, which just calls exit(1).
|
||||
// Ignore errors if it doesn't exist.
|
||||
_ = shutdown.Unregister("libpod")
|
||||
|
||||
errChan := make(chan error, 1)
|
||||
|
||||
|
Reference in New Issue
Block a user