Esempio n. 1
0
 /**
  * Output execution status information to the console
  *
  * @param OutputInterface|StyleInterface $output
  * @param ConsoleTask $task
  * @param int $number The number of the task to be executed
  * @param int $total The total amount of tasks to be executed
  */
 protected function outputExecutionInfo($output, ConsoleTask $task, $number, $total)
 {
     $taskXofY = "Task ({$number}/{$total})";
     // Special formatting, if Symfony Style is provided
     if ($output instanceof StyleInterface) {
         $output->section($task->getName());
         $output->text($task->getDescription());
         $output->text($taskXofY);
         $output->newLine();
         return;
     }
     // Std. formatting
     $output->writeln($task->getName());
     $output->writeln('--------------------------------');
     $output->writeln($task->getDescription());
     $output->writeln($taskXofY);
     $output->writeln('');
 }
Esempio n. 2
0
 private function setUpSignalHandler(StyleInterface $consoleStyle, string $memoryLimitFile)
 {
     if (function_exists('pcntl_signal')) {
         pcntl_signal(SIGINT, function () use($consoleStyle, $memoryLimitFile) {
             if (file_exists($memoryLimitFile)) {
                 unlink($memoryLimitFile);
             }
             $consoleStyle->newLine();
             exit(1);
         });
     }
 }