Fixing white space, adding try/except block, and specifying permissions without stat.

This commit is contained in:
Rob 2020-05-19 12:41:32 -07:00
parent bf4361ae92
commit ac6256f9a0

View File

@ -1836,17 +1836,12 @@ def write_json_file(obj, fn):
os.unlink(fn) os.unlink(fn)
except OSError: except OSError:
pass pass
mask = os.umask(0) try:
os.umask(mask) mask = os.umask(0)
os.chmod(tf.name, os.umask(mask)
(stat.S_IRUSR os.chmod(tf.name, 0o666 & ~mask)
| stat.S_IWUSR except OSError:
| stat.S_IRGRP pass
| stat.S_IWGRP
| stat.S_IROTH
| stat.S_IWOTH)
& ~mask)
os.rename(tf.name, fn) os.rename(tf.name, fn)
except Exception: except Exception:
try: try: