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)