Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
context_managers: Open file in write mode in lockfile_nonblocking.
Mateusz Manderab572fa93cd99
diff --git a/zerver/lib/context_managers.py b/zerver/lib/context_managers.pyindex 5010973e66f..8728d87dd28 100644--- a/zerver/lib/context_managers.py+++ b/zerver/lib/context_managers.py@@ -37,7 +37,7 @@ def lockfile_nonblocking(filename: str) -> Iterator[bool]: # nocoverage"""Lock a file using flock(2) for the duration of a 'with' statement.Doesn't block, yields False immediately if the lock can't be acquired."""- with open(filename) as f:+ with open(filename, "w") as f:lock_acquired = Falsetry:fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)