Skip to content

Commit 95101a0

Browse files
committed
More parallel debugging
1 parent 1fd761d commit 95101a0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Command/WorkerCommand.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
133133
$analysedFiles = array_fill_keys($analysedFiles, true);
134134

135135
$tcpConector = new TcpConnector($loop);
136-
$tcpConector->connect(sprintf('127.0.0.1:%d', $port))->done(function (ConnectionInterface $connection) use ($container, $identifier, $analysedFiles, $tmpFile, $insteadOfFile): void {
136+
$tcpConector->connect(sprintf('127.0.0.1:%d', $port))->done(function (ConnectionInterface $connection) use ($container, $identifier, $output, $analysedFiles, $tmpFile, $insteadOfFile): void {
137137
$out = new Encoder($connection);
138138
$in = new Decoder($connection, true, 512, 0, $container->getParameter('parallel')['buffer']);
139139
$out->write(['action' => 'hello', 'identifier' => $identifier]);
140-
$this->runWorker($container, $out, $in, $analysedFiles, $tmpFile, $insteadOfFile);
140+
$this->runWorker($container, $out, $in, $output, $analysedFiles, $tmpFile, $insteadOfFile);
141141
});
142142

143143
$loop->run();
@@ -149,6 +149,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
149149
* @param Container $container
150150
* @param WritableStreamInterface $out
151151
* @param ReadableStreamInterface $in
152+
* @param OutputInterface $output
152153
* @param array<string, true> $analysedFiles
153154
* @param string|null $tmpFile
154155
* @param string|null $insteadOfFile
@@ -157,12 +158,14 @@ private function runWorker(
157158
Container $container,
158159
WritableStreamInterface $out,
159160
ReadableStreamInterface $in,
161+
OutputInterface $output,
160162
array $analysedFiles,
161163
?string $tmpFile,
162164
?string $insteadOfFile
163165
): void
164166
{
165-
$handleError = static function (\Throwable $error) use ($out): void {
167+
$handleError = static function (\Throwable $error) use ($out, $output): void {
168+
$output->writeln(sprintf('Error: %s', $error->getMessage()));
166169
$out->write([
167170
'action' => 'result',
168171
'result' => [

0 commit comments

Comments
 (0)