Skip to content

Commit

Permalink
Check if Drupal was located before calling realpath
Browse files Browse the repository at this point in the history
  • Loading branch information
mglaman committed Nov 15, 2021
1 parent b08ba99 commit 7389b15
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Command/CheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
}

$drupalFinder->locateRoot($drupalRootCandidate);
$this->drupalRoot = realpath($drupalFinder->getDrupalRoot());
$this->vendorRoot = realpath($drupalFinder->getVendorDir());
if ($drupalFinder->locateRoot($drupalRootCandidate)) {
$this->drupalRoot = realpath($drupalFinder->getDrupalRoot());
$this->vendorRoot = realpath($drupalFinder->getVendorDir());
}

if (!$this->drupalRoot) {
$output->writeln(sprintf('<error>Unable to locate the Drupal root in %s</error>', $drupalRootCandidate));
Expand Down

0 comments on commit 7389b15

Please sign in to comment.