Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Commit

Permalink
Search recursively upwards for an autoloader
Browse files Browse the repository at this point in the history
  • Loading branch information
fredemmott committed Sep 26, 2017
1 parent bcfe272 commit af27365
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion bin/hhast-lint
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@

namespace Facebook\HHAST\__Private;

require_once(__DIR__.'/../vendor/hh_autoload.php');
$root = realpath(__DIR__.'/..');
$found_autoloader = false;
while (true) {
$autoloader = $root.'/vendor/hh_autoload.php';
if (file_exists($autoloader)) {
$found_autoloader = true;
require_once($autoloader);
break;
}
if ($root === '') {
break;
}
$parts = explode('/', $root);
array_pop($parts);
$root = implode('/', $parts);
}

if (!$found_autoloader) {
fprintf(STDERR, "Failed to find autoloader.\n");
exit(1);
}

exit(\HH\Asio\join((new LinterCLI(vec($argv)))->mainAsync()));

0 comments on commit af27365

Please sign in to comment.