Exemplo n.º 1
0
 /**
  * Run all commands
  *
  * @return bool
  */
 private function runCommands()
 {
     $self = $this;
     $cliResponse = [];
     # Try to execute the commands
     try {
         # Add command to task to change working directory
         array_unshift($this->commands, 'cd ' . $this->basePath);
         # Run commands
         $this->remoteConnection->run($this->commands, function ($line) use($self, &$cliResponse) {
             $cliResponse[] = $self->parseResponse($line);
         });
         # Check if we need to e-mail the output
         if ($this->isMailEnabled()) {
             $this->mailSuccess($cliResponse);
         }
         return true;
     } catch (RuntimeException $e) {
         $this->setErrorMessage($e->getMessage());
         # Check if we need to e-mail the output
         if ($this->isMailEnabled()) {
             $this->mailFailed();
         }
     }
     return false;
 }