From bab610722fa87623f06205d74b18634b7bf99d57 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 29 Mar 2022 02:11:14 +0800 Subject: [PATCH] Add error exit code --- src/ZM/Utils/ZMUtil.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ZM/Utils/ZMUtil.php b/src/ZM/Utils/ZMUtil.php index 2670711d..6f2d825c 100644 --- a/src/ZM/Utils/ZMUtil.php +++ b/src/ZM/Utils/ZMUtil.php @@ -26,9 +26,10 @@ use function substr; class ZMUtil { /** + * @param mixed $error_exit * @throws Exception */ - public static function stop() + public static function stop($error_exit = false) { if (SpinLock::tryLock('_stop_signal') === false) { return; @@ -37,7 +38,7 @@ class ZMUtil if (Console::getLevel() >= 4) { Console::trace(); } - ZMAtomic::get('stop_signal')->set(1); + ZMAtomic::get('stop_signal')->set($error_exit ? 2 : 1); server()->shutdown(); }