write($title); // 8 is the length of the label + 2 let it breathe $padding = $width - $this->getLength($title) - 10; try { $response = $closure(function ($content) use ($output, &$padding) { $padding -= $this->getLength($content); $output->write($content); }); } catch (\Exception $e) { $output->writeln(str_pad(' ', $padding) . '[ FAIL ]'); throw $e; } $output->writeln(str_pad(' ', $padding) . '[ OK ]'); return $response; } }