From 7d0bbbf6c6bb6ac57a4ceb0b5b9b573fabb2b12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 18 Sep 2020 17:09: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 --- Console/Application.php | 83 ----------------------------------------- System/Application.php | 4 +- 2 files changed, 1 insertion(+), 86 deletions(-) delete mode 100644 Console/Application.php diff --git a/Console/Application.php b/Console/Application.php deleted file mode 100644 index 6274e78b..00000000 --- a/Console/Application.php +++ /dev/null @@ -1,83 +0,0 @@ -console = new Console(); - } - - - /** - * @param $class - * @throws - */ - public function register($class) - { - if (is_string($class) || is_callable($class, true)) { - $class = Snowflake::createObject($class); - } - $this->console->signCommand($class); - } - - - /** - * @param null $kernel - * @return string|void - * @throws \Exception - */ - public function run($kernel = null) - { - try { - $kernel = make($kernel, Kernel::class); - - Runtime::enableCoroutine(SWOOLE_HOOK_ALL); - - $this->console->setParameters(); - $this->console->batch($kernel); - $class = $this->console->search(); - $params = response()->send($this->console->execCommand($class)); - } catch (\Exception $exception) { - $params = response()->send(implode("\n", [ - 'Msg: ' . $exception->getMessage(), - 'Line: ' . $exception->getLine(), - 'File: ' . $exception->getFile() - ])); - } finally { - Timer::clearAll(); - return $params; - } - } - -} diff --git a/System/Application.php b/System/Application.php index 51762ecf..5c25584b 100644 --- a/System/Application.php +++ b/System/Application.php @@ -96,9 +96,7 @@ class Application extends BaseApplication $manager = Snowflake::app()->get('console'); $manager->setParameters($argv); $class = $manager->search(); - Coroutine::create(function ($manager, $class) { - response()->send($manager->execCommand($class)); - }, $manager, $class); + response()->send($manager->execCommand($class)); } catch (\Throwable $exception) { response()->send(implode("\n", [ 'Msg: ' . $exception->getMessage(),