|
21 | 21 | use RuntimeException; |
22 | 22 | use Symfony\Component\Console\Helper\ProcessHelper; |
23 | 23 | use Composer\Command\BaseCommand; |
24 | | -use Symfony\Component\Console\Input\ArrayInput; |
25 | | -use Symfony\Component\Console\Input\InputInterface; |
| 24 | +use Symfony\Component\Console\Input\StringInput; |
26 | 25 | use Symfony\Component\Console\Output\OutputInterface; |
27 | 26 | use Symfony\Component\Filesystem\Filesystem; |
28 | 27 | use Symfony\Component\Filesystem\Path; |
@@ -181,27 +180,17 @@ protected function getDevToolsFile(string $filename): string |
181 | 180 | /** |
182 | 181 | * Configures and executes a registered console command by name. |
183 | 182 | * |
184 | | - * The method MUST look up the command from the application and run it. It SHALL ignore generic |
185 | | - * validation errors and route the custom input and output correctly. |
| 183 | + * The method MUST run the specified command with the provided input and output interfaces. |
186 | 184 | * |
187 | | - * @param string $commandName the name of the required command |
188 | | - * @param array|InputInterface $input the input arguments or array definition |
| 185 | + * @param string $command the commandline name of the command to execute |
189 | 186 | * @param OutputInterface $output the interface for buffering output |
190 | 187 | * |
191 | 188 | * @return int the status code resulting from the dispatched command |
192 | 189 | */ |
193 | | - protected function runCommand(string $commandName, array|InputInterface $input, OutputInterface $output): int |
| 190 | + protected function runCommand(string $command, OutputInterface $output): int |
194 | 191 | { |
195 | | - $application = $this->getApplication(); |
196 | | - |
197 | | - $command = $application->find($commandName); |
198 | | - $command->ignoreValidationErrors(); |
199 | | - |
200 | | - if (\is_array($input)) { |
201 | | - $input = new ArrayInput($input); |
202 | | - } |
203 | | - |
204 | | - return $command->run($input, $output); |
| 192 | + return $this->getApplication() |
| 193 | + ->doRun(new StringInput($command), $output); |
205 | 194 | } |
206 | 195 |
|
207 | 196 | /** |
|
0 commit comments