Skip to content

Commit

Permalink
Merge pull request #10 from hallyn/initpid
Browse files Browse the repository at this point in the history
Set init pid
  • Loading branch information
brauner authored Apr 22, 2019
2 parents 5c8a9d3 + 75c9c58 commit 0f77e5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var deleteCmd = cli.Command{
`,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "force",
Name: "force",
Usage: "force deletion",
},
},
Expand Down
3 changes: 2 additions & 1 deletion cmd/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ func doState(ctx *cli.Context) error {
// https://github.com/opencontainers/runtime-spec/blob/v1.0.0-rc4/runtime.md#state
// it means "the container process has neither exited nor executed the user-specified program"
status := "stopped"
pid := 0
if c.Running() && checkHackyPreStart(c) == "started" {
status = "running"
pid = c.InitPid()
}
pid := 0
// bundlePath is the enclosing directory of the rootfs:
// https://github.com/opencontainers/runtime-spec/blob/v1.0.0-rc4/bundle.md
bundlePath := filepath.Dir(c.ConfigItem("lxc.rootfs.path")[0])
Expand Down
5 changes: 3 additions & 2 deletions test/basic.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function teardown() {
crictl runp test/basic-pod-config.json
crictl pull busybox
crictl images
crictl create clowncore test/basic-container-config.json test/basic-pod-config.json
[ "$(crictl ps)" | grep clowncore ]
podid=$(crictl pods | grep nginx-sandbox | awk '{ print $1 }')
crictl create $podid test/basic-container-config.json test/basic-pod-config.json
[ "$(crictl ps -a)" | grep busybox ]
}

0 comments on commit 0f77e5b

Please sign in to comment.