Ensure the parent process is always killed

If you try to run the test suite but do not have a redis instance
running, the parent process that was supposed to be killed will never be
as the thing being thrown is not an exception.
This results in the test suite hanging forever at the end.
In this patch, the exception is thrown again, and then caught in the trait, and
the parent gets killed as it should.
This commit is contained in:
Grégoire Paris 2019-04-06 11:47:31 +02:00
parent 25db9e26c9
commit 94d41825fd
No known key found for this signature in database
GPG Key ID: 6CE0C6A7B0858F70

View File

@ -74,8 +74,8 @@ trait BlockingStoreTestTrait
// Block SIGHUP signal
pcntl_sigprocmask(SIG_BLOCK, [SIGHUP]);
$store = $this->getStore();
try {
$store = $this->getStore();
$store->save($key);
// send the ready signal to the parent
posix_kill($parentPID, SIGHUP);
@ -87,7 +87,8 @@ trait BlockingStoreTestTrait
usleep($clockDelay);
$store->delete($key);
exit(0);
} catch (\Exception $e) {
} catch (\Throwable $e) {
posix_kill($parentPID, SIGHUP);
exit(1);
}
}