Knp\Bundle\KnpBundlesBundle\Command\KbSolrServerStartCommand::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->utils = $this->getContainer()->get('knp_bundles.utils.solr');
        if ($input->getOption('show-commands-only')) {
            $output->writeln(sprintf('<info>%s</info>', $this->createRunSolrCommand($input)));
            return 0;
        }
        if ($this->utils->isSolrRunning()) {
            $output->writeln(sprintf('<info>%s %d</info>', 'Solr is running. Pid: ', $this->utils->getSolrPid()));
            return 0;
        }
        $output->writeln(sprintf('<info>%s</info>', 'Starting solr in background process'));
        $process = new Process($this->createRunSolrCommand($input));
        $process->run();
        $output->writeln(sprintf('<info>Pid: %d</info>', $this->utils->getSolrPid()));
        return 0;
    }