8000 [WebServerBundle] prevent console.terminate from being fired after st… · symfony/symfony@699339e · GitHub
[go: up one dir, main page]

Skip to content

Commit 699339e

Browse files
committed
[WebServerBundle] prevent console.terminate from being fired after stopping server
1 parent 9b3bf5d commit 699339e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Console\Output\OutputInterface;
2020
use Symfony\Component\Console\Output\ConsoleOutputInterface;
2121
use Symfony\Component\Console\Style\SymfonyStyle;
22+
use Symfony\Component\EventDispatcher\EventDispatcher;
2223

2324
/**
2425
* Runs a local web server in a background process.
@@ -132,6 +133,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
132133
$io->error('Running this server in production environment is NOT recommended!');
133134
}
134135

136+
// replace event dispatcher with an empty one to prevent console.terminate from firing
137+
// as container could have changed between start and stop
138+
$this->getApplication()->setDispatcher(new EventDispatcher());
139+
135140
try {
136141
$server = new WebServer();
137142
if ($server->isRunning($input->getOption('pidfile'))) {

0 commit comments

Comments
 (0)
0