Automatically start server:run if server:start failed

This commit is contained in:
WouterJ 2015-04-03 14:47:25 +02:00
parent aae98a924b
commit f95d89c382

View File

@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@ -75,6 +76,12 @@ EOF
$output->writeln('<error>This command needs the pcntl extension to run.</error>');
$output->writeln('You can either install it or use the <info>server:run</info> command instead to run the built-in web server.');
if ($this->getHelper('question')->ask($input, $output, new ConfirmationQuestion('Do you want to start <info>server:run</info> immediately? [Yn] ', true))) {
$command = $this->getApplication()->find('server:run');
return $command->run($input, $output);
}
return 1;
}