container: StopSignal(): return syscall.Signal

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-05-02 01:16:56 +02:00
parent ea1eb449b7
commit 21df9a04e0
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
3 changed files with 5 additions and 6 deletions

View file

@ -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.

View file

@ -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)
}

View file

@ -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 != "" {