From 6a0aa9f4d519eb870d1051e56ca7df04686a21bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Mar 2021 10:33:38 +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 | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/System/Application.php b/System/Application.php index 49f9c343..1aa1649e 100644 --- a/System/Application.php +++ b/System/Application.php @@ -107,26 +107,25 @@ class Application extends BaseApplication */ public function start(Input $argv): void { -// try { -// fire(Event::SERVER_BEFORE_START); - if (env('debug') == 'false') { - $annotation = Snowflake::app()->getAttributes(); - $annotation->read(directory('app'), 'App'); + try { + fire(Event::SERVER_BEFORE_START); + if (env('debug') == 'false') { + $annotation = Snowflake::app()->getAttributes(); + $annotation->read(directory('app'), 'App'); + } + $manager = Snowflake::app()->get('console'); + $manager->setParameters($argv); + $class = $manager->search(); + response()->send($manager->execCommand($class)); + } catch (\Throwable $exception) { + response()->send(implode("\n", [ + 'Msg: ' . $exception->getMessage(), + 'Line: ' . $exception->getLine(), + 'File: ' . $exception->getFile() + ])); + } finally { + Timer::clearAll(); } - $manager = Snowflake::app()->get('console'); - $manager->setParameters($argv); - $class = $manager->search(); - response()->send($manager->execCommand($class)); -// } catch (\Throwable $exception) { -// var_dump($exception); -//// response()->send(implode("\n", [ -//// 'Msg: ' . $exception->getMessage(), -//// 'Line: ' . $exception->getLine(), -//// 'File: ' . $exception->getFile() -//// ])); -// } finally { -// Timer::clearAll(); -// } } /**