Does this help ? https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Application.php#L857
Maybe I'm wrong and misunderstood what you're looking for.