From f95d89c38248bc5630ec8c2ab6282026c029f083 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Fri, 3 Apr 2015 14:47:25 +0200 Subject: [PATCH] Automatically start server:run if server:start failed --- .../Bundle/FrameworkBundle/Command/ServerStartCommand.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php index 7808560835..9110bb1b43 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php @@ -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('This command needs the pcntl extension to run.'); $output->writeln('You can either install it or use the server:run command instead to run the built-in web server.'); + if ($this->getHelper('question')->ask($input, $output, new ConfirmationQuestion('Do you want to start server:run immediately? [Yn] ', true))) { + $command = $this->getApplication()->find('server:run'); + + return $command->run($input, $output); + } + return 1; }