diff --git a/HttpServer/Action.php b/HttpServer/Action.php index d8d1462d..46722dbf 100644 --- a/HttpServer/Action.php +++ b/HttpServer/Action.php @@ -15,38 +15,6 @@ use Swoole\WebSocket\Server; trait Action { - /** - * @param $argv - * @return Server - * @throws - */ - public function getSwooleServer($argv) - { - /** @var \HttpServer\Server $socket */ - $socket = Snowflake::app()->get('server'); -// if (isset($argv[2])) { -// $this->modify($argv, $socket); -// } - - if (!isset($argv[1])) $argv[1] = 'start'; - - return $this->checkAction($argv, $socket); - } - - /** - * @param $argv - * @param $socket - * @return Server - * @throws Exception - */ - private function checkAction($argv, $socket) - { - if (!in_array($argv[1], ['stop', 'start', 'restart'])) { - exit($this->error('action not exists.')); - } - return $this->{$argv[1]}($socket); - } - /** * @param \HttpServer\Server $socket * @return mixed @@ -134,7 +102,11 @@ trait Action if (empty($port)) { return false; } - exec('netstat -tunlp | grep ' . $port, $output); + if (Snowflake::isLinux()) { + exec('netstat -tunlp | grep ' . $port, $output); + } else { + exec('lsof -i :' . $port . ' | grep -i "LISTEN"', $output); + } if (empty($output)) { return false; } diff --git a/System/Abstracts/Input.php b/System/Abstracts/Input.php index c0607d84..783d1b5b 100644 --- a/System/Abstracts/Input.php +++ b/System/Abstracts/Input.php @@ -68,7 +68,7 @@ class Input { $arrays = []; $parameters = array_slice($parameters, 1); - $this->_command = array_shift($parameters); +// $this->_command = array_shift($parameters); foreach ($parameters as $parameter) { $explode = explode('=', $parameter); if (count($explode) < 2) {