Revert "Use which instead of whereis (#11407)" (#11413)

This reverts commit 3925e78d84.
This commit is contained in:
Tony Murray
2020-04-12 09:09:18 -05:00
committed by GitHub
parent e37417e6c2
commit faac90d2b3

View File

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