This commit is contained in:
2020-09-18 16:59:46 +08:00
parent 3c82bdae4f
commit 6eeb287ea2
+6 -4
View File
@@ -20,6 +20,7 @@ use Snowflake\Abstracts\Config;
use Snowflake\Abstracts\Input; use Snowflake\Abstracts\Input;
use Snowflake\Exception\NotFindClassException; use Snowflake\Exception\NotFindClassException;
use Snowflake\Exception\ConfigException; use Snowflake\Exception\ConfigException;
use Swoole\Coroutine;
use Swoole\Timer; use Swoole\Timer;
/** /**
@@ -85,7 +86,7 @@ class Application extends BaseApplication
/** /**
* @param $argv * @param $argv
* @return bool|string * @return bool|string|void
* @throws * @throws
*/ */
public function start(Input $argv) public function start(Input $argv)
@@ -95,16 +96,17 @@ class Application extends BaseApplication
$manager = Snowflake::app()->get('console'); $manager = Snowflake::app()->get('console');
$manager->setParameters($argv); $manager->setParameters($argv);
$class = $manager->search(); $class = $manager->search();
$params = response()->send($manager->execCommand($class)); Coroutine::create(function ($manager, $class) {
response()->send($manager->execCommand($class));
}, $manager, $class);
} catch (\Throwable $exception) { } catch (\Throwable $exception) {
$params = response()->send(implode("\n", [ response()->send(implode("\n", [
'Msg: ' . $exception->getMessage(), 'Msg: ' . $exception->getMessage(),
'Line: ' . $exception->getLine(), 'Line: ' . $exception->getLine(),
'File: ' . $exception->getFile() 'File: ' . $exception->getFile()
])); ]));
} finally { } finally {
Timer::clearAll(); Timer::clearAll();
return $params;
} }
} }