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()
4646
4747 private function getOpenedSemaphores ()
4848 {
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+
4958 $ lines = explode (PHP_EOL , trim (`LC_ALL=C ipcs -su `));
5059 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 ));
5261 }
5362 list ($ key , $ value ) = explode (' = ' , $ lines [1 ]);
5463 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 ));
5665 }
5766
5867 return (int ) $ value ;
You can’t perform that action at this time.
0 commit comments