fix chmod for read only files
parent
66ea3c6634
commit
0705e6bc25
|
@ -209,5 +209,10 @@ func writeFile(dst string, f assets.CopyableFile, perms os.FileMode) error {
|
|||
if n != int64(f.GetLength()) {
|
||||
return fmt.Errorf("%s: expected to write %d bytes, but wrote %d instead", dst, f.GetLength(), n)
|
||||
}
|
||||
|
||||
if err := w.Chmod(os.FileMode(perms)); err != nil {
|
||||
return errors.Wrap(err, "chmod")
|
||||
}
|
||||
|
||||
return w.Close()
|
||||
}
|
||||
|
|
|
@ -166,11 +166,6 @@ func (e *execRunner) Copy(f assets.CopyableFile) error {
|
|||
}
|
||||
defer os.Remove(tmpfile.Name())
|
||||
|
||||
// ... set the file permission ...
|
||||
if err := tmpfile.Chmod(os.FileMode(perms)); err != nil {
|
||||
return errors.Wrap(err, "error setting file permissions")
|
||||
}
|
||||
|
||||
if err := writeFile(tmpfile.Name(), f, os.FileMode(perms)); err != nil {
|
||||
return errors.Wrapf(err, "error writing to tempfile %s", tmpfile.Name())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue