Skip to content

Commit

Permalink
Remove open check for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Dec 6, 2024
1 parent 86dca58 commit 4085e34
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/FileMutex.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,7 @@ public function acquire(?Cancellation $cancellation = null): Lock

try {
$handle = \fopen($this->fileName, 'c');
if (!$handle) {
throw new SyncException(\sprintf(
'Unable to open or create file at %s: %s',
$this->fileName,
\error_get_last()['message'] ?? 'Unknown error',
));
}

if (\flock($handle, \LOCK_EX | \LOCK_NB)) {
if ($handle && \flock($handle, \LOCK_EX | \LOCK_NB)) {
return new Lock(fn () => $this->release($handle));
}
} finally {
Expand Down

0 comments on commit 4085e34

Please sign in to comment.