|
4 | 4 |
|
5 | 5 | use GuzzleHttp\Client; |
6 | 6 | use Illuminate\Support\Facades\Http; |
| 7 | +use Illuminate\Support\Str; |
7 | 8 | use Laravel\Octane\FrankenPhp\Concerns\FindsFrankenPhpBinary; |
8 | 9 | use Symfony\Component\Process\Process; |
9 | 10 | use Throwable; |
@@ -126,13 +127,24 @@ protected function downloadFrankenPhpBinary() |
126 | 127 | */ |
127 | 128 | protected function ensureFrankenPhpBinaryMeetsRequirements($frakenPhpBinary) |
128 | 129 | { |
129 | | - $version = tap(new Process([$frakenPhpBinary, '--version'], base_path())) |
| 130 | + $buildInfo = tap(new Process([$frakenPhpBinary, 'build-info'], base_path())) |
130 | 131 | ->run() |
131 | 132 | ->getOutput(); |
132 | 133 |
|
133 | | - $version = explode(' ', $version)[1] ?? null; |
| 134 | + $lineWithVersion = collect(explode("\n", $buildInfo)) |
| 135 | + ->first(function ($line) { |
| 136 | + return str_starts_with($line, 'dep') && str_contains($line, 'github.com/dunglas/frankenphp'); |
| 137 | + }); |
134 | 138 |
|
135 | | - if ($version === null || preg_match('/\d+\.\d+\.\d+/', $version) !== 1) { |
| 139 | + if ($lineWithVersion === null) { |
| 140 | + return $this->warn( |
| 141 | + 'Unable to determine the current FrankenPHP binary version. Please report this issue: https://github.com/laravel/octane/issues/new.', |
| 142 | + ); |
| 143 | + } |
| 144 | + |
| 145 | + $version = Str::of($lineWithVersion)->trim()->afterLast('v')->value(); |
| 146 | + |
| 147 | + if (preg_match('/\d+\.\d+\.\d+/', $version) !== 1) { |
136 | 148 | return $this->warn( |
137 | 149 | 'Unable to determine the current FrankenPHP binary version. Please report this issue: https://github.com/laravel/octane/issues/new.', |
138 | 150 | ); |
|
0 commit comments