private function getOutputToWriteTo($stdErr = false)
    {
        if ($stdErr && $this->output instanceof ConsoleOutputInterface) {
            return $this->output->getErrorOutput();
        }

        return $this->output;
    }