| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public static function execute($command, $baseDir, $allowErrorExitCode = false) |
||
| 25 | { |
||
| 26 | $command = 'cd ' . escapeshellarg($baseDir) . '; ' . $command . ' 2>&1'; |
||
| 27 | |||
| 28 | if (DIRECTORY_SEPARATOR == '/') { |
||
| 29 | $command = 'LC_ALL=en_US.UTF-8 ' . $command; |
||
| 30 | } |
||
| 31 | exec($command, $output, $returnValue); |
||
| 32 | if ($returnValue !== 0 && !$allowErrorExitCode) { |
||
| 33 | throw new \RuntimeException(sprintf('ProcessHelper command : %s. Output: %s', $command, implode("\r\n", $output))); |
||
| 34 | } |
||
| 35 | return $output; |
||
| 36 | } |
||
| 37 | } |