/**
  * {@inheritdoc}
  */
 public function executeCommand($command, array $arguments = array())
 {
     if (empty($arguments) === false) {
         $command = ProcessUtility::escapeArguments($arguments, $command);
     }
     $process = new Process($command);
     $process->run();
     return new ProcessExecutionResult($process->getExitCode(), $process->getOutput(), strval($process->getErrorOutput()));
 }
 /**
  * {@inheritdoc}
  */
 public function executeCommand($command, array $arguments = array())
 {
     if ($this->isConnected()) {
         $this->connection->enableQuietMode();
         $this->connection->setTimeout(0);
         if (empty($arguments) === false) {
             $command = ProcessUtility::escapeArguments($arguments, $command);
         }
         if (isset($this->connection->server_channels[SFTP::CHANNEL_SHELL]) === false) {
             $this->connection->read($this->getShellPromptRegex(), SFTP::READ_REGEX);
         }
         $this->connection->write($command . "\n");
         $output = $this->getFilteredOutput($this->connection->read($this->getShellPromptRegex(), SFTP::READ_REGEX), $command);
         $this->connection->write("echo \$?\n");
         $exitCode = intval($this->getFilteredOutput($this->connection->read($this->getShellPromptRegex(), SFTP::READ_REGEX), 'echo $?'));
         $errorOutput = strval($this->connection->getStdError());
         $this->connection->disableQuietMode();
         return new ProcessExecutionResult($exitCode, $output, $errorOutput);
     }
     return new ProcessExecutionResult(126, '', "Connection adapter not connected.\n");
 }