Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Commit c6150eb

Browse files
committed
Added a check to prevent non-CLI calls from failing.
1 parent 5c7aa0c commit c6150eb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/RedisSimpleLock.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ public function __construct($identifier, Client $client, $ttl = 10000, LoggerInt
3333
$this->logger = $logger ?: new NullLogger;
3434
$this->id = mt_rand();
3535
register_shutdown_function($closure = $this->releaseClosure());
36-
pcntl_signal(SIGINT, $closure);
36+
37+
if (php_sapi_name() === 'cli') {
38+
pcntl_signal(SIGINT, $closure);
39+
}
3740
}
3841

3942
public function acquire()

0 commit comments

Comments
 (0)