diff --git a/Console/Command/InfoCommand.php b/Console/Command/InfoCommand.php index 2009937..aace90e 100644 --- a/Console/Command/InfoCommand.php +++ b/Console/Command/InfoCommand.php @@ -86,22 +86,21 @@ protected function execute(InputInterface $input, OutputInterface $output) private function getCommandInfo(InputInterface $input, OutputInterface $output, $command, $description) { try { - $result = null; - $exitCode = null; - exec($command, $result, $exitCode); - + $result = []; + + $shellExecute = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Shell::class); + $response = $shellExecute->execute($command, $result); + $output->writeln("$description"); + + $output->writeln("$response"); - - foreach ($result as $line) { - $output->writeln("$line"); - } $output->writeln('_____________________________'); - + return Command::SUCCESS; } catch (\Exception $e) { $output->writeln("Error running \"$command\" command"); - + return Command::FAILURE; } }