diff options
author | Matthew Heon <mheon@redhat.com> | 2020-10-13 14:00:35 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2020-10-13 14:21:19 -0400 |
commit | f58d2f5e75b4982774509847c18b39f4a50fd5be (patch) | |
tree | 53096a2bed60f6805ac0b25dcb297b7a0bd0078e /pkg | |
parent | 83e6e4ccdd925fa25500cff9e4b631b2c5d157cb (diff) | |
download | podman-f58d2f5e75b4982774509847c18b39f4a50fd5be.tar.gz podman-f58d2f5e75b4982774509847c18b39f4a50fd5be.tar.bz2 podman-f58d2f5e75b4982774509847c18b39f4a50fd5be.zip |
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>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/server/server.go | 5 |
1 files changed, 1 insertions, 4 deletions
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) |