aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/update.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-08-14 22:51:38 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-08-15 03:31:47 +0530
commit6440c45ff3c3209593c0f39af075e71e4ca0299a (patch)
tree6b4bad9c50ac29d66b48721391b99e6d48812d11 /yt_dlp/update.py
parentef6342bd07c7bd1e41b0cc8889bcfadfab3477f2 (diff)
downloadhypervideo-pre-6440c45ff3c3209593c0f39af075e71e4ca0299a.tar.lz
hypervideo-pre-6440c45ff3c3209593c0f39af075e71e4ca0299a.tar.xz
hypervideo-pre-6440c45ff3c3209593c0f39af075e71e4ca0299a.zip
[update] Copy bitmask from old binary
Improves a6125983ab4434fc4079f575a4bf22042411ea5e Authored by: Lesmiscore
Diffstat (limited to 'yt_dlp/update.py')
-rw-r--r--yt_dlp/update.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/yt_dlp/update.py b/yt_dlp/update.py
index a5cd11150..fc96f2985 100644
--- a/yt_dlp/update.py
+++ b/yt_dlp/update.py
@@ -230,6 +230,7 @@ class Updater:
return self._report_permission_error(new_filename)
if old_filename:
+ mask = os.stat(self.filename).st_mode
try:
os.rename(self.filename, old_filename)
except OSError:
@@ -251,7 +252,7 @@ class Updater:
self._report_error('Unable to remove the old version')
try:
- os.chmod(self.filename, 0o777)
+ os.chmod(self.filename, mask)
except OSError:
return self._report_error(
f'Unable to set permissions. Run: sudo chmod a+rx {compat_shlex_quote(self.filename)}')