mirror of
https://github.com/containers/podman.git
synced 2025-05-31 07:27:13 +08:00
Do not error on installing duplicate shutdown handler
Installing a duplicate shutdown handler fails, but if a handler with the same name is already present, we should be set to go. There's no reason to print a user-facing error about it. This comes up almost nowhere because Podman never makes more than one Libpod runtime, but there is one exception (`system reset`) and the error messages, while harmless, were making people very confused (we got several bug reports that `system reset` was nonfunctional). Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
@ -10,6 +10,10 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrHandlerExists error = errors.New("handler with given name already exists")
|
||||
)
|
||||
|
||||
var (
|
||||
stopped bool
|
||||
sigChan chan os.Signal
|
||||
@ -98,7 +102,7 @@ func Register(name string, handler func(os.Signal) error) error {
|
||||
}
|
||||
|
||||
if _, ok := handlers[name]; ok {
|
||||
return errors.Errorf("handler with name %s already exists", name)
|
||||
return ErrHandlerExists
|
||||
}
|
||||
|
||||
handlers[name] = handler
|
||||
|
Reference in New Issue
Block a user