Fix go vet errors

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
Qiang Huang 2017-01-14 21:43:31 +08:00
parent e6f6261bae
commit 5d6fa7b886
2 changed files with 13 additions and 14 deletions

View file

@ -108,7 +108,7 @@ func start(log *os.File) error {
return nil return nil
} }
var exitShim bool var exitShim bool
for { for !exitShim {
select { select {
case s := <-signals: case s := <-signals:
switch s { switch s {
@ -122,18 +122,6 @@ func start(log *os.File) error {
} }
} }
} }
// runtime has exited so the shim can also exit
if exitShim {
// kill all processes in the container incase it was not running in
// its own PID namespace
p.killAll()
// wait for all the processes and IO to finish
p.Wait()
// delete the container from the runtime
p.delete()
// the close of the exit fifo will happen when the shim exits
return nil
}
case msg := <-msgC: case msg := <-msgC:
switch msg.Type { switch msg.Type {
case 0: case 0:
@ -153,6 +141,17 @@ func start(log *os.File) error {
} }
} }
} }
// runtime has exited so the shim can also exit
// kill all processes in the container incase it was not running in
// its own PID namespace
p.killAll()
// wait for all the processes and IO to finish
p.Wait()
// delete the container from the runtime
p.delete()
// the close of the exit fifo will happen when the shim exits
return nil return nil
} }

View file

@ -36,7 +36,7 @@ type checkpoint struct {
} }
type processState struct { type processState struct {
Terminal bool `json:terminal` Terminal bool `json:"terminal"`
Exec bool `json:"exec"` Exec bool `json:"exec"`
Stdin string `json:"containerdStdin"` Stdin string `json:"containerdStdin"`
Stdout string `json:"containerdStdout"` Stdout string `json:"containerdStdout"`