From 3e64569ccf60189064b99bf015b50cba3d86e35d Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Thu, 5 Jan 2023 03:21:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E8=BE=93=E5=87=BA=20Octan?= =?UTF-8?q?e=20=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/Cluster/Work.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/Cluster/Work.php b/app/Console/Commands/Cluster/Work.php index 94e4db8..cf1a07f 100644 --- a/app/Console/Commands/Cluster/Work.php +++ b/app/Console/Commands/Cluster/Work.php @@ -15,14 +15,14 @@ class Work extends Command * * @var string */ - protected $signature = 'cluster:work'; + protected $signature = 'run'; /** * The console command description. * * @var string */ - protected $description = '开始集群协调任务。'; + protected $description = '启动此应用程序。'; /** * Execute the console command. @@ -119,7 +119,21 @@ public function handle(): int $this->info('正在启动 Web。'); $command = 'php artisan octane:start --host=0.0.0.0 --rpc-port=6001 --port=8000'; - exec($command); + // proc_open + $descriptor_spec = [ + 0 => ['pipe', 'r'], + 1 => ['pipe', 'w'], + 2 => ['pipe', 'w'], + ]; + + $process = proc_open($command, $descriptor_spec, $pipes); + + if (is_resource($process)) { + while ($s = fgets($pipes[1])) { + echo $s; + } + } + } else { // 子进程