[WebServerBundle] prevent console.terminate from being fired after stopping server

This commit is contained in:
Kevin Bond 2017-11-10 11:15:02 -05:00
parent 9b3bf5d63f
commit 699339eb0c
No known key found for this signature in database
GPG Key ID: B2FA70147E5FDEB3

View File

@ -19,6 +19,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\EventDispatcher\EventDispatcher;
/**
* Runs a local web server in a background process.
@ -132,6 +133,10 @@ EOF
$io->error('Running this server in production environment is NOT recommended!');
}
// replace event dispatcher with an empty one to prevent console.terminate from firing
// as container could have changed between start and stop
$this->getApplication()->setDispatcher(new EventDispatcher());
try {
$server = new WebServer();
if ($server->isRunning($input->getOption('pidfile'))) {