Add sync after mv (#23)

* ignore intellij project folder

* fix comment spelling

* add sync after mv
master
Jon Stevens 2018-05-18 08:30:20 +07:00 committed by Jaime Pillora
parent 7516f44481
commit bc46621374
2 changed files with 12 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
tmp tmp
myapp* myapp*
example/docker example/docker
.idea

View File

@ -26,9 +26,18 @@ func move(dst, src string) error {
return nil return nil
} }
//HACK: we're shelling out to mv because linux //HACK: we're shelling out to mv because linux
//throws errors when crossing device boundaryes. //throws errors when crossing device boundaries.
//TODO see sys_posix_mv.go //TODO see sys_posix_mv.go
return exec.Command("mv", src, dst).Run() if err := exec.Command("mv", src, dst).Run(); err != nil {
return err
}
// Run sync to 'commit' the mv by clearing caches
return sync().Run()
}
func sync() *exec.Cmd {
return exec.Command("sync")
} }
func chmod(f *os.File, perms os.FileMode) error { func chmod(f *os.File, perms os.FileMode) error {