[FrameworkBundle] Redirect server output to /dev/null in case no verbosity is needed
This commit is contained in:
parent
349549cd17
commit
6d9fd62730
@ -90,20 +90,21 @@ EOF
|
||||
|
||||
$output->writeln(sprintf("Server running on <info>http://%s</info>\n", $input->getArgument('address')));
|
||||
|
||||
$router = $input->getOption('router') ?: $this
|
||||
->getContainer()
|
||||
->get('kernel')
|
||||
->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env))
|
||||
;
|
||||
|
||||
$builder = $this->createPhpProcessBuilder($input, $output, $env);
|
||||
$builder->setWorkingDirectory($input->getOption('docroot'));
|
||||
$builder->setTimeout(null);
|
||||
$builder->getProcess()->run(function ($type, $buffer) use ($output) {
|
||||
$process = $builder->getProcess();
|
||||
|
||||
if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
|
||||
$callback = function ($type, $buffer) use ($output) {
|
||||
$output->write($buffer);
|
||||
};
|
||||
} else {
|
||||
$callback = null;
|
||||
$process->disableOutput();
|
||||
}
|
||||
});
|
||||
|
||||
$process->run($callback);
|
||||
}
|
||||
|
||||
private function createPhpProcessBuilder(InputInterface $input, OutputInterface $output, $env)
|
||||
|
Reference in New Issue
Block a user