engine: catchall handler is shadowed by specific handlers
This allows using `Engine.Register` and `Engine.RegisterCatchall` on the same engine without the catchall hiding all other handlers. Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes) Upstream-commit: de75af9fe2d91df7297e498d320b496addfb52f4 Component: engine
This commit is contained in:
@@ -118,13 +118,12 @@ func (eng *Engine) Job(name string, args ...string) *Job {
|
||||
if eng.Logging {
|
||||
job.Stderr.Add(utils.NopWriteCloser(eng.Stderr))
|
||||
}
|
||||
if eng.catchall != nil {
|
||||
|
||||
// Catchall is shadowed by specific Register.
|
||||
if handler, exists := eng.handlers[name]; exists {
|
||||
job.handler = handler
|
||||
} else if eng.catchall != nil {
|
||||
job.handler = eng.catchall
|
||||
} else {
|
||||
handler, exists := eng.handlers[name]
|
||||
if exists {
|
||||
job.handler = handler
|
||||
}
|
||||
}
|
||||
return job
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user