8000 improve handling router script paths · symfony/symfony@0a16cf2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0a16cf2

Browse files
committed
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.
1 parent 1033dc5 commit 0a16cf2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
101101
->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env))
102102
;
103103

104+
if (!file_exists($router)) {
105+
$output->writeln(sprintf('<error>The given router script "%s" does not exist</error>', $router));
106+
107+
return 1;
108+
}
109+
110+
$router = realpath($router);
111+
104112
$output->writeln(sprintf("Server running on <info>http://%s</info>\n", $input->getArgument('address')));
105113

106114
$builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router));

0 commit comments

Comments
 (0)
0