From f58d2f5e75b4982774509847c18b39f4a50fd5be Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Tue, 13 Oct 2020 14:00:35 -0400 Subject: 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 --- pkg/api/server/server.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'pkg/api/server') diff --git a/pkg/api/server/server.go b/pkg/api/server/server.go index 24ad1874b..64008767b 100644 --- a/pkg/api/server/server.go +++ b/pkg/api/server/server.go @@ -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) -- cgit v1.2.3-54-g00ecf