setName('xtask:stop')->setDescription('Smooth stop of all task processes'); } /** * 停止所有任务执行 * @param Input $input * @param Output $output */ protected function execute(Input $input, Output $output) { $process = ProcessService::instance(); $command = $process->think('xtask:'); if (count($result = $process->query($command)) < 1) { $output->writeln("There is no task process to finish"); } else foreach ($result as $item) { $process->close($item['pid']); $output->writeln("Sending end process {$item['pid']} signal succeeded"); } } }