1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

pkg/signal: move Trap() to cmd/dockerd

It's the only location where this is used, and it's quite specific
to dockerd (not really a reusable function for external use), so
moving it into that package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-07-15 18:08:17 +02:00
parent ea5c94cdb9
commit 0880df4644
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
4 changed files with 6 additions and 6 deletions

View file

@ -32,6 +32,7 @@ import (
buildkit "github.com/docker/docker/builder/builder-next"
"github.com/docker/docker/builder/dockerfile"
"github.com/docker/docker/cli/debug"
"github.com/docker/docker/cmd/dockerd/trap"
"github.com/docker/docker/daemon"
"github.com/docker/docker/daemon/cluster"
"github.com/docker/docker/daemon/config"
@ -44,7 +45,6 @@ import (
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/pidfile"
"github.com/docker/docker/pkg/plugingetter"
"github.com/docker/docker/pkg/signal"
"github.com/docker/docker/pkg/sysinfo"
"github.com/docker/docker/pkg/system"
"github.com/docker/docker/plugin"
@ -183,7 +183,7 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
stopc := make(chan bool)
defer close(stopc)
signal.Trap(func() {
trap.Trap(func() {
cli.stop()
<-stopc // wait for daemonCli.start() to return
}, logrus.StandardLogger())

View file

@ -5,7 +5,7 @@ import (
"syscall"
"time"
"github.com/docker/docker/pkg/signal"
"github.com/docker/docker/cmd/dockerd/trap"
"github.com/sirupsen/logrus"
)
@ -15,7 +15,7 @@ func main() {
"QUIT": syscall.SIGQUIT,
"INT": os.Interrupt,
}
signal.Trap(func() {
trap.Trap(func() {
time.Sleep(time.Second)
os.Exit(99)
}, logrus.StandardLogger())

View file

@ -1,4 +1,4 @@
package signal // import "github.com/docker/docker/pkg/signal"
package trap // import "github.com/docker/docker/cmd/dockerd/trap"
import (
"fmt"

View file

@ -1,6 +1,6 @@
// +build linux
package signal // import "github.com/docker/docker/pkg/signal"
package trap // import "github.com/docker/docker/cmd/dockerd/trap"
import (
"io/ioutil"