From 87449e04f26a298915a283fdb35478968ab9c446 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 13 Jul 2014 13:34:23 +0200 Subject: [PATCH] backport more error information from 2.6 to 2.3 The commit on master was: server:run command: provide more error information The server:run command didn't provide many information when the executed command exited unexpectedly. Now, the process' exit code is passed through and an error message is displayed. --- .../FrameworkBundle/Command/ServerRunCommand.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php index 3535167910..380e72fcf9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php @@ -106,10 +106,21 @@ EOF $builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router)); $builder->setWorkingDirectory($documentRoot); $builder->setTimeout(null); - $builder->getProcess()->run(function ($type, $buffer) use ($output) { + $process = $builder->getProcess(); + $process->run(function ($type, $buffer) use ($output) { if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { $output->write($buffer); } }); + + if (!$process->isSuccessful()) { + $output->writeln('Built-in server terminated unexpectedly'); + + if (OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) { + $output->writeln('Run the command again with -v option for more details'); + } + } + + return $process->getExitCode(); } }