Skip to content

Commit

Permalink
Write errors of proxy command to stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
cmuench committed Oct 16, 2023
1 parent 7d79a06 commit ee42ae5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/N98/Magento/Command/MagentoCoreProxyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\Process;

Expand Down Expand Up @@ -86,8 +87,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf('<debug> - TTY: <comment>%b</comment></debug>', $process->isTty()));
}

$process->run(function ($type, $buffer) use ($output) {
$output->write($buffer);
$errOutput = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;

$process->run(function ($type, $buffer) use ($output, $errOutput) {
if (Process::ERR === $type) {
$errOutput->write($buffer);
} else {
$output->write($buffer);
}
});

return $process->getExitCode();
Expand Down

0 comments on commit ee42ae5

Please sign in to comment.