From cdd28a8c43225b84f9ab04a802635101252cf288 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Sun, 25 Apr 2021 01:32:30 +0800 Subject: [PATCH] modify --- HttpServer/Http/Response.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/HttpServer/Http/Response.php b/HttpServer/Http/Response.php index c5d330dc..9590afc5 100644 --- a/HttpServer/Http/Response.php +++ b/HttpServer/Http/Response.php @@ -200,18 +200,20 @@ class Response extends HttpService $result = Help::toString($result); $string = PHP_EOL . 'Command Result: ' . PHP_EOL . PHP_EOL; - if (!str_contains($result, 'Event::rshutdown(): Event::wait()')) { - if (empty($result)) { - $string .= 'success!' . PHP_EOL . PHP_EOL; - } else { - $string .= $result . PHP_EOL . PHP_EOL; - } - $string .= 'Command End!' . PHP_EOL . PHP_EOL; - print_r($string); + defer(function () { + fire('CONSOLE_END'); + }); + if (str_contains((string)$result, 'Event::rshutdown(): Event::wait()')) { + return (string)$result; } - $event = Snowflake::app()->getEvent(); - $event->trigger('CONSOLE_END'); + if (empty($result)) { + $string .= 'success!' . PHP_EOL . PHP_EOL; + } else { + $string .= $result . PHP_EOL . PHP_EOL; + } + $string .= 'Command End!' . PHP_EOL . PHP_EOL; + print_r($string); return $result; }