From 0239cbfbacea7d946d4113d304dcde7e26e5dfe4 Mon Sep 17 00:00:00 2001 From: Massimiliano Torromeo Date: Tue, 31 Mar 2026 10:10:31 +0200 Subject: [PATCH 1/3] fix: give up early starting the testing roadrunner command if the process terminates --- testing/src/Environment.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/src/Environment.php b/testing/src/Environment.php index cd65655c..c2a6c790 100644 --- a/testing/src/Environment.php +++ b/testing/src/Environment.php @@ -126,7 +126,7 @@ public function startTemporalServer( $this->temporalServerProcess->start(); $deadline = \microtime(true) + (float) $commandTimeout; - while (!$temporalStarted && \microtime(true) < $deadline) { + while ($this->temporalServerProcess->isRunning() && !$temporalStarted && \microtime(true) < $deadline) { \usleep(10_000); $check = new Process([ $this->systemInfo->temporalCliExecutable, @@ -217,7 +217,7 @@ public function startRoadRunner(?array $rrCommand = null, int $commandTimeout = // wait for roadrunner to start $deadline = \microtime(true) + (float) $commandTimeout; - while (!$roadRunnerStarted && \microtime(true) < $deadline) { + while ($this->roadRunnerProcess->isRunning() && !$roadRunnerStarted && \microtime(true) < $deadline) { \usleep(10_000); $check = new Process([$this->systemInfo->rrExecutable, 'workers', '-c', $configFile]); $check->run(); @@ -226,7 +226,7 @@ public function startRoadRunner(?array $rrCommand = null, int $commandTimeout = } } - if (!$roadRunnerStarted) { + if (!$roadRunnerStarted || !$this->roadRunnerProcess->isRunning()) { $this->io->error(\sprintf( 'Failed to start until RoadRunner is ready. Status: "%s". Stderr: "%s". Stdout: "%s".', $this->roadRunnerProcess->getStatus(), From 042ea2c7197d7dede390977ababc068b35c89186 Mon Sep 17 00:00:00 2001 From: Massimiliano Torromeo Date: Tue, 31 Mar 2026 10:10:49 +0200 Subject: [PATCH 2/3] fix: do not ignore the $configFile parameter of the testing environment --- testing/src/Environment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/src/Environment.php b/testing/src/Environment.php index c2a6c790..5368c791 100644 --- a/testing/src/Environment.php +++ b/testing/src/Environment.php @@ -205,7 +205,7 @@ public function startRoadRunner(?array $rrCommand = null, int $commandTimeout = } $this->roadRunnerProcess = new Process( - command: $rrCommand ?? [$this->systemInfo->rrExecutable, 'serve'], + command: $rrCommand ?? [$this->systemInfo->rrExecutable, 'serve', '-c', $configFile], env: $envs, ); $this->roadRunnerProcess->setTimeout($commandTimeout); From f260474d2d93422684c91c615ef7fae74052dfaa Mon Sep 17 00:00:00 2001 From: Massimiliano Torromeo Date: Tue, 31 Mar 2026 10:14:22 +0200 Subject: [PATCH 3/3] fix: allow use of custom roadrunner command in the check loop of startRoadRunner --- testing/src/Environment.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testing/src/Environment.php b/testing/src/Environment.php index 5368c791..a09e9e6b 100644 --- a/testing/src/Environment.php +++ b/testing/src/Environment.php @@ -203,9 +203,11 @@ public function startRoadRunner(?array $rrCommand = null, int $commandTimeout = ]); exit(1); } + + $rrCommand ??= [$this->systemInfo->rrExecutable, 'serve', '-c', $configFile] $this->roadRunnerProcess = new Process( - command: $rrCommand ?? [$this->systemInfo->rrExecutable, 'serve', '-c', $configFile], + command: $rrCommand, env: $envs, ); $this->roadRunnerProcess->setTimeout($commandTimeout); @@ -219,7 +221,7 @@ public function startRoadRunner(?array $rrCommand = null, int $commandTimeout = $deadline = \microtime(true) + (float) $commandTimeout; while ($this->roadRunnerProcess->isRunning() && !$roadRunnerStarted && \microtime(true) < $deadline) { \usleep(10_000); - $check = new Process([$this->systemInfo->rrExecutable, 'workers', '-c', $configFile]); + $check = new Process(array_map(static fn ($arg) => $arg === 'serve' ? 'workers' : $arg, $rrCommand)); $check->run(); if (\str_contains($check->getOutput(), 'Workers of')) { $roadRunnerStarted = true;