From 84f8be79dc7d079772038d843f5c91bcf59e5c91 Mon Sep 17 00:00:00 2001 From: gaobinzhan Date: Fri, 18 Dec 2020 18:03:11 +0800 Subject: [PATCH] fix: exec command const --- src/Command/DefaultCommand/Crontab.php | 2 +- src/Command/DefaultCommand/Process.php | 2 +- src/Command/DefaultCommand/Task.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Command/DefaultCommand/Crontab.php b/src/Command/DefaultCommand/Crontab.php index 55669b0c..2530199d 100644 --- a/src/Command/DefaultCommand/Crontab.php +++ b/src/Command/DefaultCommand/Crontab.php @@ -38,10 +38,10 @@ public function help(CommandHelpInterface $commandHelp): CommandHelpInterface public function exec(): ?string { - Core::getInstance()->initialize(); $action = CommandManager::getInstance()->getArg(0); $exe = "{$this->commandName()}.{$action}"; Di::getInstance()->set(SysConst::EXECUTE_COMMAND,$exe); + Core::getInstance()->initialize(); $run = new Scheduler(); $run->add(function () use (&$result, $action) { if (method_exists($this, $action) && $action != 'help') { diff --git a/src/Command/DefaultCommand/Process.php b/src/Command/DefaultCommand/Process.php index d22aeb43..fc079ad1 100644 --- a/src/Command/DefaultCommand/Process.php +++ b/src/Command/DefaultCommand/Process.php @@ -42,10 +42,10 @@ public function help(CommandHelpInterface $commandHelp): CommandHelpInterface public function exec(): ?string { - Core::getInstance()->initialize(); $action = CommandManager::getInstance()->getArg(0); $exe = "{$this->commandName()}.{$action}"; Di::getInstance()->set(SysConst::EXECUTE_COMMAND,$exe); + Core::getInstance()->initialize(); $run = new Scheduler(); $run->add(function () use (&$result, $action) { if (method_exists($this, $action) && $action != 'help') { diff --git a/src/Command/DefaultCommand/Task.php b/src/Command/DefaultCommand/Task.php index bc6b8a1d..2a44b3dc 100644 --- a/src/Command/DefaultCommand/Task.php +++ b/src/Command/DefaultCommand/Task.php @@ -35,10 +35,10 @@ public function help(CommandHelpInterface $commandHelp): CommandHelpInterface public function exec(): ?string { - Core::getInstance()->initialize(); $action = CommandManager::getInstance()->getArg(0); $exe = "{$this->commandName()}.{$action}"; Di::getInstance()->set(SysConst::EXECUTE_COMMAND,$exe); + Core::getInstance()->initialize(); $run = new Scheduler(); $run->add(function () use (&$result, $action) { if (method_exists($this, $action) && $action != 'help') {