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:
parent
ea5c94cdb9
commit
0880df4644
4 changed files with 6 additions and 6 deletions
|
@ -32,6 +32,7 @@ import (
|
||||||
buildkit "github.com/docker/docker/builder/builder-next"
|
buildkit "github.com/docker/docker/builder/builder-next"
|
||||||
"github.com/docker/docker/builder/dockerfile"
|
"github.com/docker/docker/builder/dockerfile"
|
||||||
"github.com/docker/docker/cli/debug"
|
"github.com/docker/docker/cli/debug"
|
||||||
|
"github.com/docker/docker/cmd/dockerd/trap"
|
||||||
"github.com/docker/docker/daemon"
|
"github.com/docker/docker/daemon"
|
||||||
"github.com/docker/docker/daemon/cluster"
|
"github.com/docker/docker/daemon/cluster"
|
||||||
"github.com/docker/docker/daemon/config"
|
"github.com/docker/docker/daemon/config"
|
||||||
|
@ -44,7 +45,6 @@ import (
|
||||||
"github.com/docker/docker/pkg/jsonmessage"
|
"github.com/docker/docker/pkg/jsonmessage"
|
||||||
"github.com/docker/docker/pkg/pidfile"
|
"github.com/docker/docker/pkg/pidfile"
|
||||||
"github.com/docker/docker/pkg/plugingetter"
|
"github.com/docker/docker/pkg/plugingetter"
|
||||||
"github.com/docker/docker/pkg/signal"
|
|
||||||
"github.com/docker/docker/pkg/sysinfo"
|
"github.com/docker/docker/pkg/sysinfo"
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
"github.com/docker/docker/plugin"
|
"github.com/docker/docker/plugin"
|
||||||
|
@ -183,7 +183,7 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
|
||||||
stopc := make(chan bool)
|
stopc := make(chan bool)
|
||||||
defer close(stopc)
|
defer close(stopc)
|
||||||
|
|
||||||
signal.Trap(func() {
|
trap.Trap(func() {
|
||||||
cli.stop()
|
cli.stop()
|
||||||
<-stopc // wait for daemonCli.start() to return
|
<-stopc // wait for daemonCli.start() to return
|
||||||
}, logrus.StandardLogger())
|
}, logrus.StandardLogger())
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/signal"
|
"github.com/docker/docker/cmd/dockerd/trap"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ func main() {
|
||||||
"QUIT": syscall.SIGQUIT,
|
"QUIT": syscall.SIGQUIT,
|
||||||
"INT": os.Interrupt,
|
"INT": os.Interrupt,
|
||||||
}
|
}
|
||||||
signal.Trap(func() {
|
trap.Trap(func() {
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
os.Exit(99)
|
os.Exit(99)
|
||||||
}, logrus.StandardLogger())
|
}, logrus.StandardLogger())
|
|
@ -1,4 +1,4 @@
|
||||||
package signal // import "github.com/docker/docker/pkg/signal"
|
package trap // import "github.com/docker/docker/cmd/dockerd/trap"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
|
@ -1,6 +1,6 @@
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package signal // import "github.com/docker/docker/pkg/signal"
|
package trap // import "github.com/docker/docker/cmd/dockerd/trap"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
Loading…
Add table
Reference in a new issue