Preserve file permissions when copying files

This commit is contained in:
kolaente 2020-09-02 22:09:25 +02:00
parent e1502fe872
commit 07b69bfd28
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 10 additions and 0 deletions

View File

@ -232,6 +232,16 @@ func copyFile(src, dst string) error {
if err != nil {
return err
}
si, err := os.Stat(src)
if err != nil {
return err
}
if err := os.Chmod(dst, si.Mode()); err != nil {
return err
}
return out.Close()
}