| @@ 144-149 (lines=6) @@ | ||
| 141 | */ |
|
| 142 | private function connect(array $hosts) |
|
| 143 | { |
|
| 144 | $callback = function (string $output) { |
|
| 145 | $output = preg_replace('/\n$/', '', $output); |
|
| 146 | if (strlen($output) !== 0) { |
|
| 147 | $this->output->writeln($output); |
|
| 148 | } |
|
| 149 | }; |
|
| 150 | ||
| 151 | // Connect to each host sequentially, to prevent getting locked. |
|
| 152 | foreach ($hosts as $host) { |
|
| @@ 202-207 (lines=6) @@ | ||
| 199 | $process->start(); |
|
| 200 | } |
|
| 201 | ||
| 202 | $callback = function (string $output) { |
|
| 203 | $output = preg_replace('/\n$/', '', $output); |
|
| 204 | if (strlen($output) !== 0) { |
|
| 205 | $this->output->writeln($output); |
|
| 206 | } |
|
| 207 | }; |
|
| 208 | ||
| 209 | $this->server->addPeriodicTimer(0.03, function () use ($processes, $callback) { |
|
| 210 | $this->gatherOutput($processes, $callback); |
|