diff --git a/src/Plugins/Parallel/Paratest/WrapperRunner.php b/src/Plugins/Parallel/Paratest/WrapperRunner.php index 8b75bc4c..0c955574 100644 --- a/src/Plugins/Parallel/Paratest/WrapperRunner.php +++ b/src/Plugins/Parallel/Paratest/WrapperRunner.php @@ -254,11 +254,11 @@ private function startWorker(int $token): WrapperWorker private function destroyWorker(int $token): void { - // Mutation Testing tells us that the following `unset()` already destroys - // the `WrapperWorker`, which destroys the Symfony's `Process`, which - // automatically calls `Process::stop` within `Process::__destruct()`. - // But we prefer to have an explicit stops. $this->workers[$token]->stop(); + // We need to wait for ApplicationForWrapperWorker::end to end + while ($this->workers[$token]->isRunning()) { + usleep(self::CYCLE_SLEEP); + } unset($this->workers[$token]); }