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:
parent
1033dc59cd
commit
0a16cf2102
@ -101,6 +101,14 @@ EOF
|
|||||||
->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env))
|
->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')));
|
$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));
|
$builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router));
|
||||||
|
Reference in New Issue
Block a user