protected function getConsoleFile()
    {
        if (strpos($_SERVER['argv'][0], 'phpunit') !== false) {
            $kernelDir = $this->getContainer()->get('kernel')->getRootDir();
            if (is_file("$kernelDir/console")) {
                return "$kernelDir/console";
            }
            if (is_file("$kernelDir/../bin/console")) {
                return "$kernelDir/../bin/console";
            }
            throw new \Exception("Can not determine the name of the symfony console file in use for running as separate process");
        }

        return $_SERVER['argv'][0]; // sf console
    }