public function catchOutput()
{
while (count($this->outputStorage) > 0) {
list(, $messages, , $type) = $this->outputStorage->pop();
$format = function ($message) {
$message = rtrim($message, "\n");
return implode("\n", array_map(function ($text) {
return $text;
}, explode("\n", $message)));
};
$this->output->writeln(array_map($format, (array) $messages), $type);
}
}