From 748b5df90273028cfe99d02e641fccb636e84faa Mon Sep 17 00:00:00 2001 From: xishang0128 Date: Fri, 25 Jul 2025 23:32:29 +0900 Subject: [PATCH] chore: keep original file permissions after update --- component/updater/update_core.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/component/updater/update_core.go b/component/updater/update_core.go index f200fad0..48510906 100644 --- a/component/updater/update_core.go +++ b/component/updater/update_core.go @@ -73,7 +73,7 @@ func (u *CoreUpdater) Update(currentExePath string) (err error) { u.mu.Lock() defer u.mu.Unlock() - _, err = os.Stat(currentExePath) + info, err := os.Stat(currentExePath) if err != nil { return fmt.Errorf("check currentExePath %q: %w", currentExePath, err) } @@ -146,6 +146,8 @@ func (u *CoreUpdater) Update(currentExePath string) (err error) { return fmt.Errorf("backuping: %w", err) } + _ = os.Chmod(updateExePath, info.Mode()) + err = u.replace(updateExePath, currentExePath) if err != nil { return fmt.Errorf("replacing: %w", err)