[Lock] Fix SemaphoreStoreTest on OS X
This commit is contained in:
parent
7f9a262e74
commit
9055611dc3
@ -50,13 +50,22 @@ class SemaphoreStoreTest extends AbstractStoreTest
|
||||
|
||||
private function getOpenedSemaphores()
|
||||
{
|
||||
if ('Darwin' === PHP_OS) {
|
||||
$lines = explode(PHP_EOL, trim(`ipcs -s`));
|
||||
if (-1 === $start = array_search('Semaphores:', $lines)) {
|
||||
throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore list, got '.implode(PHP_EOL, $lines));
|
||||
}
|
||||
|
||||
return \count(\array_slice($lines, ++$start));
|
||||
}
|
||||
|
||||
$lines = explode(PHP_EOL, trim(`LC_ALL=C ipcs -su`));
|
||||
if ('------ Semaphore Status --------' !== $lines[0]) {
|
||||
throw new \Exception('Failed to extract list of opend semaphores. Expect a Semaphore status, got '.implode(PHP_EOL, $lines));
|
||||
throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore status, got '.implode(PHP_EOL, $lines));
|
||||
}
|
||||
list($key, $value) = explode(' = ', $lines[1]);
|
||||
if ('used arrays' !== $key) {
|
||||
throw new \Exception('Failed to extract list of opend semaphores. Expect a used arrays key, got '.implode(PHP_EOL, $lines));
|
||||
throw new \Exception('Failed to extract list of opened semaphores. Expected a "used arrays" key, got '.implode(PHP_EOL, $lines));
|
||||
}
|
||||
|
||||
return (int) $value;
|
||||
|
Reference in New Issue
Block a user