diff --git a/src/Illuminate/Foundation/Console/ServeCommand.php b/src/Illuminate/Foundation/Console/ServeCommand.php index a41393179530..16997fd69996 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) { @@ -70,7 +70,7 @@ public function handle() $process->stop(5); - $process = $this->startProcess(); + $process = $this->startProcess($hasEnvironment); } usleep(500 * 1000); @@ -90,12 +90,13 @@ 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]; }