You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
newInputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'),
38
+
newInputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script', dirname(__DIR__).'/Resources/router.php'),
43
39
))
44
40
->setName('server:run')
45
41
->setDescription('Runs a local web server')
@@ -65,7 +61,6 @@ protected function configure()
65
61
"prod", or "test".
66
62
67
63
See also: http://www.php.net/manual/en/features.commandline.webserver.php
68
-
69
64
EOF
70
65
)
71
66
;
@@ -83,85 +78,45 @@ protected function execute(InputInterface $input, OutputInterface $output)
83
78
}
84
79
85
80
if (!is_dir($documentRoot)) {
86
-
$io->error(sprintf('The document root directory "%s" does not exist', $documentRoot));
81
+
$io->error(sprintf('The document root directory "%s" does not exist.', $documentRoot));
if ($this->isOtherServerProcessRunning($address)) {
99
-
$io->error(sprintf('A process is already listening on http://%s.', $address));
100
-
101
-
return1;
102
-
}
103
-
104
-
if (false === $router = $this->determineRouterScript($documentRoot, $input->getOption('router'), $env)) {
105
-
$io->error('Unable to guess the front controller file.');
106
-
107
-
return1;
108
-
}
109
-
110
87
if ('prod' === $env) {
111
88
$io->error('Running this server in production environment is NOT recommended!');
112
89
}
113
90
114
-
$io->success(sprintf('Server listening on http://%s', $address));
115
-
$io->comment('Quit the server with CONTROL-C.');
91
+
$router = $input->getOption('router');
116
92
117
-
if (null === $builder = $this->createPhpProcessBuilder($io, $address, $router, $env)) {
118
-
return1;
119
-
}
120
-
121
-
$builder->setWorkingDirectory($documentRoot);
122
-
$builder->setTimeout(null);
123
-
$process = $builder->getProcess();
124
93
$callback = null;
125
-
126
-
if (OutputInterface::VERBOSITY_NORMAL > $output->getVerbosity()) {
127
-
$process->disableOutput();
94
+
$disableOutput = false;
95
+
if ($output->isQuiet()) {
96
+
$disableOutput = true;
128
97
} else {
129
-
try {
130
-
$process->setTty(true);
131
-
} catch (RuntimeException$e) {
132
-
$callback = function ($type, $buffer) use ($output) {
133
-
if (Process::ERR === $type && $outputinstanceof ConsoleOutputInterface) {
$errorMessages[] = 'Run the command again with -v option for more details.';
147
-
}
110
+
$io->success(sprintf('Server listening on http://%s', $server->getAddress()));
0 commit comments