mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-12-23 19:30:09 +08:00
chore: keep original file permissions after update
This commit is contained in:
parent
8cbae59d55
commit
748b5df902
@ -73,7 +73,7 @@ func (u *CoreUpdater) Update(currentExePath string) (err error) {
|
|||||||
u.mu.Lock()
|
u.mu.Lock()
|
||||||
defer u.mu.Unlock()
|
defer u.mu.Unlock()
|
||||||
|
|
||||||
_, err = os.Stat(currentExePath)
|
info, err := os.Stat(currentExePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("check currentExePath %q: %w", currentExePath, err)
|
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)
|
return fmt.Errorf("backuping: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_ = os.Chmod(updateExePath, info.Mode())
|
||||||
|
|
||||||
err = u.replace(updateExePath, currentExePath)
|
err = u.replace(updateExePath, currentExePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("replacing: %w", err)
|
return fmt.Errorf("replacing: %w", err)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user