You are here

private function SensorGitDirtyTree::runCommand in Monitoring 7

Run a command providing an error message.

Parameters

string $cmd: Command we want to run.

string $error: Error message to show when failing.

Return value

array Output of executing the Shell command.

1 call to SensorGitDirtyTree::runCommand()
SensorGitDirtyTree::settingsForm in lib/Drupal/monitoring/Sensor/Sensors/SensorGitDirtyTree.php
Gets settings form for a specific sensor.

File

lib/Drupal/monitoring/Sensor/Sensors/SensorGitDirtyTree.php, line 340
Contains \Drupal\monitoring\Sensor\Sensors\SensorGitDirtyTree.

Class

SensorGitDirtyTree
Monitors the git repository for dirty files.

Namespace

Drupal\monitoring\Sensor\Sensors

Code

private function runCommand($cmd, $error) {
  $exit_code = 0;
  exec($this
    ->buildCommand($cmd), $output, $exit_code);
  if ($exit_code > 0) {
    drupal_set_message($error, 'error');
  }
  return $output;
}