예제 #1
0
 /**
  * Runs a command and returns it output
  *
  * @param \Symfony\Component\HttpKernel\Client $client
  * @param                                      $command
  *
  * @return string|\Symfony\Component\Console\Output\StreamOutput
  */
 public function runCommand(Client $client, $command)
 {
     $application = new Application($client->getKernel());
     $application->setAutoExit(false);
     $fp = tmpfile();
     $input = new StringInput($command);
     $output = new StreamOutput($fp);
     $application->run($input, $output);
     fseek($fp, 0);
     $output = '';
     while (!feof($fp)) {
         $output = fread($fp, 4096);
     }
     fclose($fp);
     return $output;
 }
예제 #2
0
 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @throws \Exception When doRun returns Exception
  *
  * @return int 0 if everything went fine, or an error code
  */
 public function run(InputInterface $input = null, OutputInterface $output = null)
 {
     try {
         return parent::run($input, $output);
     } catch (Exception $e) {
         if ($this->isAjax() === false) {
             throw $e;
         }
         while ($prevException = $e->getPrevious()) {
             $e = $prevException;
         }
         $this->renderException($e, $output);
         return 1;
     } catch (Throwable $e) {
         if ($this->isAjax() === false) {
             throw $e;
         }
         $e = new FatalThrowableError($e);
         $this->renderException($e, $output);
         return 1;
     }
 }
예제 #3
0
 /**
  * Runs the current application.
  *
  * @param \Symfony\Component\Console\InputInterface $input An Input instance
  * @param \Symfony\Component\Console\OutputInterface $output An Output instance
  * @return int 0 if everything went fine, or an error code
  * @throws \Exception When doRun returns Exception
  * @api 
  * @static 
  */
 public static function run($input = null, $output = null)
 {
     //Method inherited from \Symfony\Component\Console\Application
     return \Illuminate\Console\Application::run($input, $output);
 }
예제 #4
0
 /**
  * Handle an incoming console command.
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return int
  */
 public function handle($input, $output = null)
 {
     return $this->artisan->run($input, $output);
 }