Separeted CommandExecutor for different OS
This commit is contained in:
parent
5f0b45924e
commit
d32c43713d
7 changed files with 206 additions and 147 deletions
33
PHPCI/Helper/UnixCommandExecutor.php
Normal file
33
PHPCI/Helper/UnixCommandExecutor.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCI\Helper;
|
||||
|
||||
class UnixCommandExecutor extends BaseCommandExecutor
|
||||
{
|
||||
/**
|
||||
* Find a binary required by a plugin.
|
||||
* @param string $binary
|
||||
* @return null|string
|
||||
*/
|
||||
public function findBinary($binary)
|
||||
{
|
||||
$binaryPath = parent::findBinary($binary);
|
||||
if (is_null($binaryPath)) {
|
||||
|
||||
if (is_string($binary)) {
|
||||
$binary = array($binary);
|
||||
}
|
||||
|
||||
foreach ($binary as $bin) {
|
||||
$findCmdResult = trim(shell_exec('which ' . $bin));
|
||||
|
||||
if (!empty($findCmdResult)) {
|
||||
$this->logger->log("Found in " . $findCmdResult, LogLevel::DEBUG);
|
||||
$binaryPath = $findCmdResult;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $binaryPath;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue