Selaa lähdekoodia

Fix run-script --list failing to handle native script handlers, fixes #7069

Jordi Boggiano 7 vuotta sitten
vanhempi
commit
ec9ba46c5f
1 muutettua tiedostoa jossa 7 lisäystä ja 3 poistoa
  1. 7 3
      src/Composer/Command/RunScriptCommand.php

+ 7 - 3
src/Composer/Command/RunScriptCommand.php

@@ -114,10 +114,14 @@ EOT
         $io->writeError('<info>scripts:</info>');
         $table = array();
         foreach ($scripts as $name => $script) {
-            $cmd = $this->getApplication()->find($name);
             $description = '';
-            if ($cmd instanceof ScriptAliasCommand) {
-                $description = $cmd->getDescription();
+            try {
+                $cmd = $this->getApplication()->find($name);
+                if ($cmd instanceof ScriptAliasCommand) {
+                    $description = $cmd->getDescription();
+                }
+            } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
+                // ignore scripts that have no command associated, like native Composer script listeners
             }
             $table[] = array('  '.$name, $description);
         }