Use getenv to get the paths for `find`
This commit is contained in:
parent
7c41c0c13f
commit
0f01de9f7e
|
@ -925,9 +925,10 @@ class OC_Helper {
|
||||||
// Returns null if nothing is found
|
// Returns null if nothing is found
|
||||||
$result = $exeSniffer->find($program);
|
$result = $exeSniffer->find($program);
|
||||||
if (empty($result)) {
|
if (empty($result)) {
|
||||||
// The order of the folders is important as we'll use the first command we find
|
$paths = str_replace(':','/ ',getenv('PATH'));
|
||||||
exec('find /usr/local/bin/ /usr/bin/ -name ' . escapeshellarg($program) . ' 2> /dev/null', $output, $returnCode);
|
$command = 'find ' . $paths . ' -name ' . escapeshellarg($program) . ' 2> /dev/null';
|
||||||
if ($returnCode === 0 && count($output) > 0) {
|
exec($command, $output, $returnCode);
|
||||||
|
if (count($output) > 0) {
|
||||||
$result = escapeshellcmd($output[0]);
|
$result = escapeshellcmd($output[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue