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