From 1bea0ae66e21e0b4029ab874375c5a60676a3a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 19 Aug 2021 17:52:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/ServerManager.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Server/ServerManager.php b/Server/ServerManager.php index 753ea550..450294a8 100644 --- a/Server/ServerManager.php +++ b/Server/ServerManager.php @@ -118,7 +118,7 @@ class ServerManager public function addProcess(string|CustomProcess $customProcess, $redirect_stdin_and_stdout = null, ?int $pipe_type = SOCK_DGRAM, bool $enable_coroutine = true) { $customProcess = $this->resolveProcess($customProcess); - Kiri::app()->addProcess($customProcess, $process = new Process(function (Process $soloProcess) use ($customProcess) { + $process = new Process(function (Process $soloProcess) use ($customProcess) { $system = sprintf('%s.process[%d]', Config::get('id', 'system-service'), $soloProcess->pid); if (Kiri::getPlatform()->isLinux()) { $soloProcess->name($system . '.' . $customProcess->getProcessName($soloProcess) . ' start.'); @@ -126,7 +126,8 @@ class ServerManager $customProcess->signListen($soloProcess); echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Process %s start.", $customProcess->getProcessName($soloProcess)) . PHP_EOL; $customProcess->onHandler($soloProcess); - }, $redirect_stdin_and_stdout, $pipe_type, $enable_coroutine)); + }, $redirect_stdin_and_stdout, $pipe_type, $enable_coroutine); + Kiri::app()->addProcess($customProcess, $process); $this->server->addProcess($process); }