mirror of https://github.com/containers/podman.git
				
				
				
			Merge pull request #8629 from mheon/no_error_on_dupe_handler
Do not error on installing duplicate shutdown handler
This commit is contained in:
		
						commit
						ef6748dc87
					
				|  | @ -190,7 +190,7 @@ func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...R | |||
| 	if err := shutdown.Register("libpod", func(sig os.Signal) error { | ||||
| 		os.Exit(1) | ||||
| 		return nil | ||||
| 	}); err != nil { | ||||
| 	}); err != nil && errors.Cause(err) != shutdown.ErrHandlerExists { | ||||
| 		logrus.Errorf("Error registering shutdown handler for libpod: %v", err) | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue