diff --git a/Server/ServerManager.php b/Server/ServerManager.php index 138c0876..318314aa 100644 --- a/Server/ServerManager.php +++ b/Server/ServerManager.php @@ -157,7 +157,7 @@ class ServerManager * @param array $ports * @return array */ - private function sortService(array $ports): array + public function sortService(array $ports): array { $array = []; foreach ($ports as $port) { @@ -315,7 +315,8 @@ class ServerManager return; } while ($this->checkPortIsAlready($port)) { - exec('kill ' . $pid, $execResult); + exec('kill -15 ' . $pid, $execResult); + Process::kill($pid,); usleep(300); } } diff --git a/http-helper/Server.php b/http-helper/Server.php index 819e68a2..d62ded71 100644 --- a/http-helper/Server.php +++ b/http-helper/Server.php @@ -131,7 +131,7 @@ class Server extends HttpService public function shutdown() { $configs = Config::get('server', [], true); - foreach ($configs['ports'] ?? [] as $config) { + foreach ($this->manager->sortService($configs) as $config) { $this->manager->stopServer($config['port']); } $this->eventDispatch->dispatch(new OnShutdown());