File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/Symfony/Component/Lock/Tests/Store Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -50,13 +50,22 @@ public function testResourceRemoval()
50
50
51
51
private function getOpenedSemaphores ()
52
52
{
53
+ if ('Darwin ' === PHP_OS ) {
54
+ $ lines = explode (PHP_EOL , trim (`ipcs -s `));
55
+ if (-1 === $ start = array_search ('Semaphores: ' , $ lines )) {
56
+ throw new \Exception ('Failed to extract list of opened semaphores. Expected a Semaphore list, got ' .implode (PHP_EOL , $ lines ));
57
+ }
58
+
59
+ return \count (\array_slice ($ lines , ++$ start ));
60
+ }
61
+
53
62
$ lines = explode (PHP_EOL , trim (`LC_ALL=C ipcs -su `));
54
63
if ('------ Semaphore Status -------- ' !== $ lines [0 ]) {
55
- throw new \Exception ('Failed to extract list of opend semaphores. Expect a Semaphore status, got ' .implode (PHP_EOL , $ lines ));
64
+ throw new \Exception ('Failed to extract list of opened semaphores. Expected a Semaphore status, got ' .implode (PHP_EOL , $ lines ));
56
65
}
57
66
list ($ key , $ value ) = explode (' = ' , $ lines [1 ]);
58
67
if ('used arrays ' !== $ key ) {
59
- throw new \Exception ('Failed to extract list of opend semaphores. Expect a used arrays key, got ' .implode (PHP_EOL , $ lines ));
68
+ throw new \Exception ('Failed to extract list of opened semaphores. Expected a " used arrays" key, got ' .implode (PHP_EOL , $ lines ));
60
69
}
61
70
62
71
return (int ) $ value ;
You can’t perform that action at this time.
0 commit comments