From 145f6e0bb650e1994afec5ad8962fa154f139d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 20 Aug 2021 10:16:13 +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 | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Server/ServerManager.php b/Server/ServerManager.php index 70a62ef3..723045d0 100644 --- a/Server/ServerManager.php +++ b/Server/ServerManager.php @@ -137,19 +137,21 @@ class ServerManager private function initProcess($customProcess, $redirect_stdin_and_stdout, $pipe_type, $enable_coroutine): Process { $server = $this->server; - return new Process( - function (Process $soloProcess) use ($customProcess, $server) { - if (is_string($customProcess)) { - $customProcess = Kiri::createObject($customProcess, [$server]); - } - $system = sprintf('%s.process[%d]', Config::get('id', 'system-service'), $soloProcess->pid); - if (Kiri::getPlatform()->isLinux()) { - $soloProcess->name($system . '.' . $customProcess->getProcessName($soloProcess) . ' start.'); - } - $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); - }, + return new Process(function (Process $soloProcess) use ($customProcess, $server) { + if (is_string($customProcess)) { + $customProcess = Kiri::createObject($customProcess, [$server]); + } + + $name = $customProcess->getProcessName($soloProcess); + debug(sprintf("Process %s start.", $name)); + + $system = sprintf('%s.process[%d]', Config::get('id', 'system-service'), $soloProcess->pid); + if (Kiri::getPlatform()->isLinux()) { + $soloProcess->name($system . '.' . $name . ' start.'); + } + $customProcess->signListen($soloProcess); + $customProcess->onHandler($soloProcess); + }, $redirect_stdin_and_stdout, $pipe_type, $enable_coroutine