Skip to content

Commit 041f016

Browse files
ugorurtaylorotwell
andauthored
[8.x] Add has environment variable to startProcess method (#37142)
* add has environment variable to startProcess method * fix style * fix second startProcess method * Update ServeCommand.php * Update ServeCommand.php Co-authored-by: Taylor Otwell <[email protected]>
1 parent 47408dc commit 041f016

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Illuminate/Foundation/Console/ServeCommand.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function handle()
5454
? filemtime($environmentFile)
5555
: now()->addDays(30)->getTimestamp();
5656

57-
$process = $this->startProcess();
57+
$process = $this->startProcess($hasEnvironment);
5858

5959
while ($process->isRunning()) {
6060
if ($hasEnvironment) {
@@ -70,7 +70,7 @@ public function handle()
7070

7171
$process->stop(5);
7272

73-
$process = $this->startProcess();
73+
$process = $this->startProcess($hasEnvironment);
7474
}
7575

7676
usleep(500 * 1000);
@@ -90,12 +90,13 @@ public function handle()
9090
/**
9191
* Start a new server process.
9292
*
93+
* @param bool $hasEnvironment
9394
* @return \Symfony\Component\Process\Process
9495
*/
95-
protected function startProcess()
96+
protected function startProcess($hasEnvironment)
9697
{
97-
$process = new Process($this->serverCommand(), null, collect($_ENV)->mapWithKeys(function ($value, $key) {
98-
if ($this->option('no-reload')) {
98+
$process = new Process($this->serverCommand(), null, collect($_ENV)->mapWithKeys(function ($value, $key) use ($hasEnvironment) {
99+
if ($this->option('no-reload') || ! $hasEnvironment) {
99100
return [$key => $value];
100101
}
101102

0 commit comments

Comments
 (0)