hechoendrupal / drupal-console-core

This project contains commands and features to be shared across DrupalConsole projects.
134 stars 69 forks source link

DrupalConsole should guess HOME environment variable #255

Open novia713 opened 6 years ago

novia713 commented 6 years ago

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

  root@ns3010321.ip-94-23-248.eu   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 commented 6 years ago

@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

Triloworld commented 2 years ago

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