Merge pull request #390 from rhatdan/MissingExit
If the container exit file is missing default exit code to -1
This commit is contained in:
commit
4feb74cee9
1 changed files with 14 additions and 12 deletions
|
@ -429,8 +429,9 @@ func (r *Runtime) UpdateStatus(c *Container) error {
|
||||||
exitFilePath := filepath.Join(c.bundlePath, "exit")
|
exitFilePath := filepath.Join(c.bundlePath, "exit")
|
||||||
fi, err := os.Stat(exitFilePath)
|
fi, err := os.Stat(exitFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to find container exit file: %v", err)
|
logrus.Warnf("failed to find container exit file: %v", err)
|
||||||
}
|
c.state.ExitCode = -1
|
||||||
|
} else {
|
||||||
st := fi.Sys().(*syscall.Stat_t)
|
st := fi.Sys().(*syscall.Stat_t)
|
||||||
c.state.Finished = time.Unix(st.Ctim.Sec, st.Ctim.Nsec)
|
c.state.Finished = time.Unix(st.Ctim.Sec, st.Ctim.Nsec)
|
||||||
|
|
||||||
|
@ -444,6 +445,7 @@ func (r *Runtime) UpdateStatus(c *Container) error {
|
||||||
}
|
}
|
||||||
c.state.ExitCode = int32(statusCode)
|
c.state.ExitCode = int32(statusCode)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue