File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 5
5
use Illuminate \Console \Command ;
6
6
use Spatie \Watcher \Watch ;
7
7
use Symfony \Component \Process \Process ;
8
+ use Dotenv \Dotenv ;
8
9
9
10
class WatchHorizonCommand extends Command
10
11
{
11
12
protected Process $ horizonProcess ;
12
13
13
- protected $ signature = 'horizon:watch {--without-tty : Disable output to TTY} ' ;
14
+ protected $ signature = 'horizon:watch {--without-tty : Disable output to TTY} {--reload-config : Reload configuration every time a file changes} ' ;
14
15
15
16
protected $ description = 'Run Horizon and restart it when PHP files are changed ' ;
16
17
@@ -29,7 +30,11 @@ public function handle()
29
30
30
31
protected function startHorizon (): bool
31
32
{
32
- $ this ->horizonProcess = Process::fromShellCommandline (config ('horizon-watcher.command ' ))
33
+ $ environment = $ this ->option ('reload-config ' )
34
+ ? Dotenv::createArrayBacked (base_path ())->load ()
35
+ : null ;
36
+
37
+ $ this ->horizonProcess = Process::fromShellCommandline (config ('horizon-watcher.command ' ), null , $ environment )
33
38
->setTty (! $ this ->option ('without-tty ' ))
34
39
->setTimeout (null );
35
40
You can’t perform that action at this time.
0 commit comments