Use which instead of whereis (#11407)

which searches in PATH
whereis -b doesn't exist on some OSes
This commit is contained in:
Jellyfrog
2020-04-11 13:03:39 +02:00
committed by GitHub
parent ae5da84d57
commit 3925e78d84

View File

@@ -535,13 +535,10 @@ class Config
public static function locateBinary($binary)
{
if (!str_contains($binary, '/')) {
$output = `whereis -b $binary`;
$list = trim(substr($output, strpos($output, ':') + 1));
$targets = explode(' ', $list);
foreach ($targets as $target) {
if (is_executable($target)) {
return $target;
}
$target = trim(`which $binary`);
if (!empty($target)) {
return $target;
}
}
return $binary;