Skip to content

Commit 748b5df

Browse files
committed
chore: keep original file permissions after update
1 parent 8cbae59 commit 748b5df

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

component/updater/update_core.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (u *CoreUpdater) Update(currentExePath string) (err error) {
7373
u.mu.Lock()
7474
defer u.mu.Unlock()
7575

76-
_, err = os.Stat(currentExePath)
76+
info, err := os.Stat(currentExePath)
7777
if err != nil {
7878
return fmt.Errorf("check currentExePath %q: %w", currentExePath, err)
7979
}
@@ -146,6 +146,8 @@ func (u *CoreUpdater) Update(currentExePath string) (err error) {
146146
return fmt.Errorf("backuping: %w", err)
147147
}
148148

149+
_ = os.Chmod(updateExePath, info.Mode())
150+
149151
err = u.replace(updateExePath, currentExePath)
150152
if err != nil {
151153
return fmt.Errorf("replacing: %w", err)

0 commit comments

Comments
 (0)