Merge pull request #663 from runcom/fix-arch-goos
oci: fix type mismatch on some platform/arch
This commit is contained in:
commit
2fcc6d574b
3 changed files with 29 additions and 3 deletions
14
oci/finished.go
Normal file
14
oci/finished.go
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// +build !arm !386
|
||||||
|
|
||||||
|
package oci
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getFinishedTime(fi os.FileInfo) time.Time {
|
||||||
|
st := fi.Sys().(*syscall.Stat_t)
|
||||||
|
return time.Unix(st.Ctim.Sec, st.Ctim.Nsec)
|
||||||
|
}
|
14
oci/finished_32.go
Normal file
14
oci/finished_32.go
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// +build arm 386
|
||||||
|
|
||||||
|
package oci
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getFinishedTime(fi os.FileInfo) time.Time {
|
||||||
|
st := fi.Sys().(*syscall.Stat_t)
|
||||||
|
return time.Unix(int64(st.Ctim.Sec), int64(st.Ctim.Nsec))
|
||||||
|
}
|
|
@ -585,9 +585,7 @@ func (r *Runtime) UpdateStatus(c *Container) error {
|
||||||
logrus.Warnf("failed to find container exit file: %v", err)
|
logrus.Warnf("failed to find container exit file: %v", err)
|
||||||
c.state.ExitCode = -1
|
c.state.ExitCode = -1
|
||||||
} else {
|
} else {
|
||||||
st := fi.Sys().(*syscall.Stat_t)
|
c.state.Finished = getFinishedTime(fi)
|
||||||
c.state.Finished = time.Unix(st.Ctim.Sec, st.Ctim.Nsec)
|
|
||||||
|
|
||||||
statusCodeStr, err := ioutil.ReadFile(exitFilePath)
|
statusCodeStr, err := ioutil.ReadFile(exitFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to read exit file: %v", err)
|
return fmt.Errorf("failed to read exit file: %v", err)
|
||||||
|
|
Loading…
Reference in a new issue