From 26ad648b57a6405aea4467fe7e068d8bf15e45f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Umurcan=20G=C3=B6r=C3=BCr?= Date: Tue, 27 Apr 2021 15:17:59 +0000 Subject: [PATCH 1/5] add has environment variable to startProcess method --- src/Illuminate/Foundation/Console/ServeCommand.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Foundation/Console/ServeCommand.php b/src/Illuminate/Foundation/Console/ServeCommand.php index a41393179530..bd7c0f342da4 100644 --- a/src/Illuminate/Foundation/Console/ServeCommand.php +++ b/src/Illuminate/Foundation/Console/ServeCommand.php @@ -54,7 +54,7 @@ public function handle() ? filemtime($environmentFile) : now()->addDays(30)->getTimestamp(); - $process = $this->startProcess(); + $process = $this->startProcess($hasEnvironment); while ($process->isRunning()) { if ($hasEnvironment) { @@ -90,12 +90,14 @@ public function handle() /** * Start a new server process. * + * @param bool $hasEnvironment + * * @return \Symfony\Component\Process\Process */ - protected function startProcess() + protected function startProcess($hasEnvironment) { - $process = new Process($this->serverCommand(), null, collect($_ENV)->mapWithKeys(function ($value, $key) { - if ($this->option('no-reload')) { + $process = new Process($this->serverCommand(), null, collect($_ENV)->mapWithKeys(function ($value, $key) use ($hasEnvironment) { + if ($this->option('no-reload') || !$hasEnvironment) { return [$key => $value]; } From 98b2d813b0ef4eab169064d46caa1748b99ee4b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Umurcan=20G=C3=B6r=C3=BCr?= Date: Tue, 27 Apr 2021 15:22:47 +0000 Subject: [PATCH 2/5] fix style --- src/Illuminate/Foundation/Console/ServeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Console/ServeCommand.php b/src/Illuminate/Foundation/Console/ServeCommand.php index bd7c0f342da4..17a5eefde4a4 100644 --- a/src/Illuminate/Foundation/Console/ServeCommand.php +++ b/src/Illuminate/Foundation/Console/ServeCommand.php @@ -97,7 +97,7 @@ public function handle() protected function startProcess($hasEnvironment) { $process = new Process($this->serverCommand(), null, collect($_ENV)->mapWithKeys(function ($value, $key) use ($hasEnvironment) { - if ($this->option('no-reload') || !$hasEnvironment) { + if ($this->option('no-reload') || ! $hasEnvironment) { return [$key => $value]; } From 109179bda74efb6e6d066e634b0c8f17ca3f7257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Umurcan=20G=C3=B6r=C3=BCr?= Date: Tue, 27 Apr 2021 15:28:25 +0000 Subject: [PATCH 3/5] fix second startProcess method --- src/Illuminate/Foundation/Console/ServeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Console/ServeCommand.php b/src/Illuminate/Foundation/Console/ServeCommand.php index 17a5eefde4a4..8ae5fbde30a3 100644 --- a/src/Illuminate/Foundation/Console/ServeCommand.php +++ b/src/Illuminate/Foundation/Console/ServeCommand.php @@ -70,7 +70,7 @@ public function handle() $process->stop(5); - $process = $this->startProcess(); + $process = $this->startProcess($hasEnvironment); } usleep(500 * 1000); From bff6a227bab10bc168a7541f861b609a7b44fcaa Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 27 Apr 2021 14:44:20 -0500 Subject: [PATCH 4/5] Update ServeCommand.php --- src/Illuminate/Foundation/Console/ServeCommand.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/Console/ServeCommand.php b/src/Illuminate/Foundation/Console/ServeCommand.php index 8ae5fbde30a3..538a174859f3 100644 --- a/src/Illuminate/Foundation/Console/ServeCommand.php +++ b/src/Illuminate/Foundation/Console/ServeCommand.php @@ -90,8 +90,7 @@ public function handle() /** * Start a new server process. * - * @param bool $hasEnvironment - * + * @param bool $hasEnvironment * @return \Symfony\Component\Process\Process */ protected function startProcess($hasEnvironment) From 340cf626526780e89e6e47ad0cd7e0e0fc43d190 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 27 Apr 2021 14:44:36 -0500 Subject: [PATCH 5/5] Update ServeCommand.php --- src/Illuminate/Foundation/Console/ServeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Console/ServeCommand.php b/src/Illuminate/Foundation/Console/ServeCommand.php index 538a174859f3..16997fd69996 100644 --- a/src/Illuminate/Foundation/Console/ServeCommand.php +++ b/src/Illuminate/Foundation/Console/ServeCommand.php @@ -90,7 +90,7 @@ public function handle() /** * Start a new server process. * - * @param bool $hasEnvironment + * @param bool $hasEnvironment * @return \Symfony\Component\Process\Process */ protected function startProcess($hasEnvironment)