From d91225375883a85fa6fddccc9ac00103e1d32eac Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 28 Apr 2021 13:57:52 +0200 Subject: Reconnects after ssh timeout --- src/Command/RunCommand.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/Command') diff --git a/src/Command/RunCommand.php b/src/Command/RunCommand.php index cc9c7fd..e76c063 100644 --- a/src/Command/RunCommand.php +++ b/src/Command/RunCommand.php @@ -5,6 +5,7 @@ namespace PHPIAC\Command; use PHPIAC\Connection; use PHPIAC\Task; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Helper\FormatterHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -28,21 +29,25 @@ class RunCommand extends Command { $config = include $input->getOption('config'); - Connection::getInstance($config['host'], $config['user'], $config['private_key_file']); + Connection::initialize($config['host'], $config['user'], $config['private_key_file']); + + /**@var FormatterHelper $formater*/ + $formater = $this->getHelper('formatter'); foreach ($config['tasks'] as $task) { /**@var Task $task*/ + $output->writeln($task->getName()); if (! $task->module->checkState()) { - $output->writeln($task->getName()); $output->writeln('Running'); - $task->module->getCommands(); + $task->module->execute(); } else { - $output->writeln($task->getName()); $output->writeln('Skipping'); } + + $output->writeln('- - -'); } return Command::SUCCESS; -- cgit v1.2.3