From 6eeb287ea2f6532affeb3baf36f3cd4a5ad76d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 18 Sep 2020 16:59:46 +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 --- System/Application.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/System/Application.php b/System/Application.php index 7c7a9256..51762ecf 100644 --- a/System/Application.php +++ b/System/Application.php @@ -20,6 +20,7 @@ use Snowflake\Abstracts\Config; use Snowflake\Abstracts\Input; use Snowflake\Exception\NotFindClassException; use Snowflake\Exception\ConfigException; +use Swoole\Coroutine; use Swoole\Timer; /** @@ -85,7 +86,7 @@ class Application extends BaseApplication /** * @param $argv - * @return bool|string + * @return bool|string|void * @throws */ public function start(Input $argv) @@ -95,16 +96,17 @@ class Application extends BaseApplication $manager = Snowflake::app()->get('console'); $manager->setParameters($argv); $class = $manager->search(); - $params = response()->send($manager->execCommand($class)); + Coroutine::create(function ($manager, $class) { + response()->send($manager->execCommand($class)); + }, $manager, $class); } catch (\Throwable $exception) { - $params = response()->send(implode("\n", [ + response()->send(implode("\n", [ 'Msg: ' . $exception->getMessage(), 'Line: ' . $exception->getLine(), 'File: ' . $exception->getFile() ])); } finally { Timer::clearAll(); - return $params; } }