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
$io->success(sprintf('Server listening on http://%s', $server->getAddress()));
105
+
$io->success(sprintf('Server listening on http://%s', $config->getAddress()));
if (WebServer::STARTED === $server->start($router)) {
106
-
$io->success(sprintf('Server listening on http://%s', $server->getAddress()));
105
+
if (WebServer::STARTED === $server->start($config, $input->getOption('pidfile'))) {
106
+
$io->success(sprintf('Server listening on http://%s', $config->getAddress()));
$io->success(sprintf('Web server still listening on http://%s', $server->getAddress()));
49
+
$server = newWebServer();
50
+
if ($server->isRunning($input->getOption('pidfile'))) {
51
+
$io->success('Web server still listening.');
52
52
} else {
53
-
$io->warning(sprintf('No web server is listening on http://%s', $server->getAddress()));
$io->success(sprintf('Stopped the web server listening on http://%s', $server->getAddress()));
thrownew \RuntimeException(sprintf('A process is already listening on http://%s.', $this->getAddress()));
32
+
thrownew \RuntimeException(sprintf('A process is already listening on http://%s.', $config->getAddress()));
73
33
}
74
34
75
-
$process = $this->createServerProcess($router);
35
+
$process = $this->createServerProcess($config);
76
36
if ($disableOutput) {
77
37
$process->disableOutput();
78
38
$callback = null;
@@ -96,10 +56,10 @@ public function run($router = null, $disableOutput = true, callable $callback =
thrownew \RuntimeException(sprintf('A process is already listening on http://%s.', $this->getAddress()));
62
+
thrownew \RuntimeException(sprintf('A process is already listening on http://%s.', $config->getAddress()));
103
63
}
104
64
105
65
$pid = pcntl_fork();
@@ -116,20 +76,20 @@ public function start($router = null)
116
76
thrownew \RuntimeException('Unable to set the child process as session leader.');
117
77
}
118
78
119
-
$process = $this->createServerProcess($router);
79
+
$process = $this->createServerProcess($config);
120
80
$process->disableOutput();
121
81
$process->start();
122
82
123
83
if (!$process->isRunning()) {
124
84
thrownew \RuntimeException('Unable to start the server process.');
// stop the web server when the lock file is removed
131
91
while ($process->isRunning()) {
132
-
if (!file_exists($lockFile)) {
92
+
if (!file_exists($pidFile)) {
133
93
$process->stop();
134
94
}
135
95
@@ -139,69 +99,57 @@ public function start($router = null)
139
99
returnself::STOPPED;
140
100
}
141
101
142
-
publicfunctionstop()
102
+
publicfunctionstop($pidFile = null)
143
103
{
144
-
if (!file_exists($lockFile = $this->getLockFile())) {
145
-
thrownew \RuntimeException(sprintf('No web server is listening on http://%s.', $this->getAddress()));
0 commit comments