drupal-console-core icon indicating copy to clipboard operation
drupal-console-core copied to clipboard

DrupalConsole should guess HOME environment variable

Open novia713 opened this issue 6 years ago • 2 comments

This is the error it throws when it can't find HOME environment variable

[email protected]   master U:1  ~/root/html/api_nexum  drupal cr all
PHP Fatal error:  Uncaught RuntimeException: Your environment or operation system isn't supported in phar:///usr/local/bin/drupal/vendor/webmozart/path-util/src/Path.php:257
Stack trace:
#0 phar:///usr/local/bin/drupal/vendor/drupal/console-core/src/Utils/ConfigurationManager.php(48): Webmozart\PathUtil\Path::getHomeDirectory()
#1 phar:///usr/local/bin/drupal/vendor/drupal/console-core/src/Bootstrap/DrupalConsoleCore.php(65): Drupal\Console\Core\Utils\ConfigurationManager->loadConfiguration('phar:///usr/loc...')
#2 phar:///usr/local/bin/drupal/bin/drupal.php(40): Drupal\Console\Core\Bootstrap\DrupalConsoleCore->boot()
#3 phar:///usr/local/bin/drupal/bin/drupal(3): require('phar:///usr/loc...')
#4 /usr/local/bin/drupal(10): require('phar:///usr/loc...')
#5 {main}
  thrown in phar:///usr/local/bin/drupal/vendor/webmozart/path-util/src/Path.php on line 257

[coming from https://github.com/hechoendrupal/drupal-console/issues/3612]

novia713 avatar Dec 04 '17 08:12 novia713

@jmolivas well, seems we are already using Path::getHomeDirectory(); in the place that the error appears. Seems that path-util doesn't guess the home directory if the HOME environment variable is not present. So, in regarding this, i attached a PR (https://github.com/webmozart/path-util/issues/24) into that project.

Hopefully, we can solve this problem when the PR were merged into path-util

novia713 avatar Dec 04 '17 11:12 novia713

It's actually in Drupal 9. Using cron in server will emit error if not added HOME environment. Reading this issue and adding manually fix issue. Pleas, add patch to check if exist and if not then use --root variable or emit proper information

Triloworld avatar Aug 04 '22 14:08 Triloworld