improve handling router script paths

The `server:run` command switches the working directory before
starting the built-in web server. Therefore, the path to a custom
router script had to be specified based on the document root path
and not based on the user's working directory.
This commit is contained in:
Christian Flothmann 2014-09-03 22:34:28 +02:00
parent 1033dc59cd
commit 0a16cf2102
1 changed files with 8 additions and 0 deletions

View File

@ -101,6 +101,14 @@ EOF
->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env))
;
if (!file_exists($router)) {
$output->writeln(sprintf('<error>The given router script "%s" does not exist</error>', $router));
return 1;
}
$router = realpath($router);
$output->writeln(sprintf("Server running on <info>http://%s</info>\n", $input->getArgument('address')));
$builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router));