This commit is contained in:
2021-12-06 11:47:12 +08:00
parent 458c6cbd22
commit 308c992fd3
+5 -6
View File
@@ -4,13 +4,12 @@ declare(strict_types=1);
namespace Server; namespace Server;
use Note\Inject;
use Exception; use Exception;
use Kiri\Abstracts\Config; use Kiri\Abstracts\Config;
use Kiri\Events\EventDispatch; use Kiri\Events\EventDispatch;
use Kiri\Exception\ConfigException; use Kiri\Exception\ConfigException;
use Kiri\Kiri; use Kiri\Kiri;
use Server\Events\OnServerBeforeStart; use Note\Inject;
use Swoole\Coroutine; use Swoole\Coroutine;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
@@ -64,13 +63,13 @@ class ServerCommand extends Command
if (!in_array($input->getArgument('action'), self::ACTIONS)) { if (!in_array($input->getArgument('action'), self::ACTIONS)) {
throw new Exception('I don\'t know what I want to do.'); throw new Exception('I don\'t know what I want to do.');
} }
if ($manager->isRunner() && $input->getArgument('action') == 'start') { $action = $input->getArgument('action');
throw new Exception('Service is running. Please use restart.'); if ($action == 'stop' || $action == 'restart') {
}
$manager->shutdown(); $manager->shutdown();
if ($input->getArgument('action') == 'stop') { if ($action == 'stop') {
return 0; return 0;
} }
}
return $this->generate_runtime_builder($manager); return $this->generate_runtime_builder($manager);
} }