atomicfile: don't Chmod on windows

Not supported.
reviewable/pr560/r1
Brad Fitzpatrick 4 years ago
parent d361511512
commit df674d4189

@ -12,6 +12,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
)
// WriteFile writes data to filename+some suffix, then renames it
@ -31,9 +32,11 @@ func WriteFile(filename string, data []byte, perm os.FileMode) (err error) {
if _, err := f.Write(data); err != nil {
return err
}
if runtime.GOOS != "windows" {
if err := f.Chmod(perm); err != nil {
return err
}
}
if err := f.Sync(); err != nil {
return err
}

Loading…
Cancel
Save