php-parallel-lint/PHP-Parallel-Lint

Linter crashes with Xdebug 3 on without listening client

jankonas opened this issue · 0 comments

When I have Xdebug 3 enabled (xdebug.mode=debug, xdebug.start_with_request=yes), but no listening client for it, PHP emits this message to stderr:

Xdebug: [Step Debug] Could not connect to debugging client. Tried: 10.254.254.254:9003 (through xdebug.client_host/xdebug.client_port) :-(

That causes linter to crash with following output:

$ vendor/bin/parallel-lint -e php src tests
Xdebug: [Step Debug] Could not connect to debugging client. Tried: 10.254.254.254:9003 (through xdebug.client_host/xdebug.client_port) :-(
PHP 7.3.26 | 10 parallel jobs
............................................................  60/124 (48 %)
.........................................................Error in skip-linting.php process
Error output: Xdebug: [Step Debug] Could not connect to debugging client. Tried: 10.254.254.254:9003 (through xdebug.client_host/xdebug.client_port) :-(

Investigating the issue I found this code snippet in ParallelLint.php:

if ($skipLintProcess->getErrorOutput()) {
    $message = "Error in skip-linting.php process\nError output: {$skipLintProcess->getErrorOutput()}";
    throw new \Exception($message);
}

Why is process error determined by stderr content instead of status code of the process? I am adding PR to change that, but maybe there is some reason for this?