Skip to content
Snippets Groups Projects
Commit 850271a1 authored by juga's avatar juga
Browse files

Check if file exists before locking it

parent cf9a55a3
Branches
Tags
No related merge requests found
......@@ -48,9 +48,9 @@ class State:
self._state = self._read()
def _read(self):
if not os.path.exists(self._fname):
return {}
with FileLock(self._fname):
if not os.path.exists(self._fname):
return {}
with open(self._fname, 'rt') as fd:
return json.load(fd)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment