diff --git a/tests/test_writer.py b/tests/test_writer.py index 8aedc7d..444909f 100644 --- a/tests/test_writer.py +++ b/tests/test_writer.py @@ -24,7 +24,7 @@ def lock_file(queue, filename): """ try: fi = open(filename, 'ab') - fcntl.flock(fi, fcntl.LOCK_EX | fcntl.LOCK_NB) + fcntl.lockf(fi, fcntl.LOCK_EX | fcntl.LOCK_NB) fi.close() queue.put('1') except IOError: diff --git a/warcprox/writer.py b/warcprox/writer.py index a3e24c6..7a1032a 100644 --- a/warcprox/writer.py +++ b/warcprox/writer.py @@ -74,7 +74,7 @@ class WarcWriter: self.logger.info('closing %s', self._f_finalname) if self._f_open_suffix == '': try: - fcntl.flock(self._f, fcntl.LOCK_UN) + fcntl.lockf(self._f, fcntl.LOCK_UN) except IOError as exc: self.logger.error('could not unlock file %s (%s)', self._fpath, exc) @@ -106,7 +106,7 @@ class WarcWriter: # file lock. if self._f_open_suffix == '': try: - fcntl.flock(self._f, fcntl.LOCK_EX | fcntl.LOCK_NB) + fcntl.lockf(self._f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError as exc: self.logger.error('could not lock file %s (%s)', self._fpath, exc)