mirror of
https://github.com/l1ving/youtube-dl
synced 2026-06-13 05:53:44 +08:00
Fixing white space, adding try/except block, and specifying permissions without stat.
This commit is contained in:
+6
-11
@@ -1836,17 +1836,12 @@ def write_json_file(obj, fn):
|
||||
os.unlink(fn)
|
||||
except OSError:
|
||||
pass
|
||||
mask = os.umask(0)
|
||||
os.umask(mask)
|
||||
os.chmod(tf.name,
|
||||
(stat.S_IRUSR
|
||||
| stat.S_IWUSR
|
||||
| stat.S_IRGRP
|
||||
| stat.S_IWGRP
|
||||
| stat.S_IROTH
|
||||
| stat.S_IWOTH)
|
||||
& ~mask)
|
||||
|
||||
try:
|
||||
mask = os.umask(0)
|
||||
os.umask(mask)
|
||||
os.chmod(tf.name, 0o666 & ~mask)
|
||||
except OSError:
|
||||
pass
|
||||
os.rename(tf.name, fn)
|
||||
except Exception:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user