From bbe78b0b7a868979434e908c3ee356bd1fa3e9e6 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij <45041769+jnoordsij@users.noreply.github.com> Date: Tue, 2 Jul 2024 12:32:17 +0200 Subject: [PATCH] Cleaner io call in Drupal root null check Co-authored-by: Alex Skrypnyk --- scripts/composer/ScriptHandler.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/composer/ScriptHandler.php b/scripts/composer/ScriptHandler.php index 7a473f1b7..a5b8d36be 100644 --- a/scripts/composer/ScriptHandler.php +++ b/scripts/composer/ScriptHandler.php @@ -22,7 +22,10 @@ public static function createRequiredFiles(Event $event) { $drupalFinder = new DrupalFinderComposerRuntime(); $drupalRoot = $drupalFinder->getDrupalRoot(); - // If Drupal root was not found, exit. + if (is_null($drupalRoot)) { + $event->getIO()->writeError('Drupal root could not be detected.'); + exit(1); + } if (is_null($drupalRoot)) { $io = $event->getIO(); $io->writeError(