Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,13 @@ module.exports = class RandomAccessFile extends RandomAccessStorage {
// Should we aquire a read lock?
const shared = self.mode === RDONLY

if (fsext.tryLock(self.fd, { shared })) onlock(null)
else onlock(createLockError(self.filename))
try {
const didLock = fsext.tryLock(self.fd, { shared })
if (didLock) onlock(null)
else onlock(createLockError(self.filename))
} catch (e) {
onlock(e)
}
}

function onlock (err) {
Expand Down