You are here

private function BenchmarkCommand::getGitHash in Devel 8.2

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::getGitHash()
  2. 8 webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::getGitHash()
  3. 4.x webprofiler/src/Command/BenchmarkCommand.php \Drupal\webprofiler\Command\BenchmarkCommand::getGitHash()

Return value

string

1 call to BenchmarkCommand::getGitHash()
BenchmarkCommand::execute in webprofiler/src/Command/BenchmarkCommand.php
Executes the current command.

File

webprofiler/src/Command/BenchmarkCommand.php, line 228

Class

BenchmarkCommand
Class BenchmarkCommand

Namespace

Drupal\webprofiler\Command

Code

private function getGitHash() {
  try {
    $process = new Process('git rev-parse HEAD');
    $process
      ->setTimeout(3600);
    $process
      ->run();
    $git_hash = $process
      ->getOutput();
  } catch (\Exception $e) {
    $git_hash = $this
      ->trans('commands.webprofiler.benchmark.messages.not_git');
  }
  return $git_hash;
}