mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
e5a7aad7eb
Docker already did this: https://github.com/docker/docker/issues/11762 libcontainer should also do it. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
41 lines
896 B
Go
41 lines
896 B
Go
package main
|
|
|
|
import (
|
|
"github.com/Sirupsen/logrus"
|
|
"github.com/codegangsta/cli"
|
|
)
|
|
|
|
var pauseCommand = cli.Command{
|
|
Name: "pause",
|
|
Usage: "pause the container's processes",
|
|
Flags: []cli.Flag{
|
|
cli.StringFlag{Name: "id", Value: "nsinit", Usage: "specify the ID for a container"},
|
|
},
|
|
Action: func(context *cli.Context) {
|
|
container, err := getContainer(context)
|
|
if err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
if err = container.Pause(); err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
},
|
|
}
|
|
|
|
var unpauseCommand = cli.Command{
|
|
Name: "unpause",
|
|
Usage: "unpause the container's processes",
|
|
Flags: []cli.Flag{
|
|
cli.StringFlag{Name: "id", Value: "nsinit", Usage: "specify the ID for a container"},
|
|
},
|
|
Action: func(context *cli.Context) {
|
|
container, err := getContainer(context)
|
|
if err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
if err = container.Resume(); err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
},
|
|
}
|