Beispiel #1
0
 /**
  * Main function of Facilior
  * @return int
  */
 public function execute()
 {
     //Greetings
     $this->console->log('Logging started');
     $this->console->output('<fg=default;options=bold>Logging started:</> <fg=magenta>' . $this->console->getLogFile() . '</>', 0, 2);
     $fileService = new FileService();
     $fileService->init();
     //Run Command and check if there is a config error
     $exitCode = $this->application->run();
     $fileService->cleanup();
     return $exitCode;
 }
Beispiel #2
0
 /**
  * @param $command
  * @param $arguments
  * @return ShellResult
  * @throws \Exception
  */
 public function execute($command, $arguments)
 {
     $shellCommand = $this->mapArguments($command, $arguments);
     $shellResult = new ShellResult($shellCommand);
     exec($shellCommand, $output, $exitCode);
     $shellResult->setExitCode($exitCode);
     $shellResult->setOutput($output);
     $this->consoleService->log('Executing: ' . $shellResult->getCommand());
     $this->consoleService->log('Output:' . implode(PHP_EOL, $output));
     if ($exitCode != 0) {
         throw new \Exception("Error in Execution. Please check your Logs");
     }
     return $shellResult;
 }