diff --git a/ServerCommand.php b/ServerCommand.php index 297bc25..b2ada93 100644 --- a/ServerCommand.php +++ b/ServerCommand.php @@ -65,14 +65,11 @@ class ServerCommand extends Command } $reusePort = Config::get('server.settings')[Constant::OPTION_ENABLE_REUSE_PORT] ?? false; - var_dump($reusePort); if (!$reusePort) { if ($manager->isRunner() && $input->getArgument('action') == 'start') { throw new Exception('Service is running. Please use restart.'); } $manager->shutdown(); - - var_dump('is shutdown.'); } if ($input->getArgument('action') == 'stop') { if ($manager->isRunner()) { diff --git a/ServerManager.php b/ServerManager.php index 9a91cf4..c943787 100644 --- a/ServerManager.php +++ b/ServerManager.php @@ -167,12 +167,11 @@ class ServerManager if (is_string($customProcess)) { $customProcess = Kiri::getDi()->get($customProcess); } - $process = new Process([$customProcess, 'process'], $customProcess->getRedirectStdinAndStdout(), - $customProcess->getPipeType(), $customProcess->isEnableCoroutine()); $system = sprintf('[%s].process', Config::get('id', 'system-service')); - if (Kiri::getPlatform()->isLinux()) { + $process = new Process(function (Process $process) use ($customProcess, $system) { $process->name($system . '(' . $customProcess->getName() . ')'); - } + $customProcess->process($process); + }, $customProcess->getRedirectStdinAndStdout(), $customProcess->getPipeType(), $customProcess->isEnableCoroutine()); $this->logger->debug($system . ' ' . $customProcess->getName() . ' start.'); $this->container->setBindings($customProcess->getName(), $process); $this->server->addProcess($process);