container: StopSignal(): return syscall.Signal
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
ea1eb449b7
commit
21df9a04e0
3 changed files with 5 additions and 6 deletions
|
@ -511,16 +511,16 @@ func (container *Container) IsDestinationMounted(destination string) bool {
|
|||
}
|
||||
|
||||
// StopSignal returns the signal used to stop the container.
|
||||
func (container *Container) StopSignal() int {
|
||||
func (container *Container) StopSignal() syscall.Signal {
|
||||
var stopSignal syscall.Signal
|
||||
if container.Config.StopSignal != "" {
|
||||
stopSignal, _ = signal.ParseSignal(container.Config.StopSignal)
|
||||
}
|
||||
|
||||
if int(stopSignal) == 0 {
|
||||
if stopSignal == 0 {
|
||||
stopSignal, _ = signal.ParseSignal(defaultStopSignal)
|
||||
}
|
||||
return int(stopSignal)
|
||||
return stopSignal
|
||||
}
|
||||
|
||||
// StopTimeout returns the timeout (in seconds) used to stop the container.
|
||||
|
|
|
@ -24,7 +24,7 @@ func TestContainerStopSignal(t *testing.T) {
|
|||
}
|
||||
|
||||
s := c.StopSignal()
|
||||
if s != int(def) {
|
||||
if s != def {
|
||||
t.Fatalf("Expected %v, got %v", def, s)
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package daemon // import "github.com/docker/docker/daemon"
|
|||
|
||||
import (
|
||||
"context"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
|
@ -43,7 +42,7 @@ func (daemon *Daemon) containerStop(ctx context.Context, ctr *container.Containe
|
|||
}
|
||||
|
||||
var (
|
||||
stopSignal = syscall.Signal(ctr.StopSignal())
|
||||
stopSignal = ctr.StopSignal()
|
||||
stopTimeout = ctr.StopTimeout()
|
||||
)
|
||||
if options.Signal != "" {
|
||||
|
|
Loading…
Reference in a new issue