php-parallel-lint / PHP-Parallel-Lint

This tool check syntax of PHP files faster than serial check with fancier output.
Other
287 stars 21 forks source link

Linter crashes with Xdebug 3 on without listening client #47

Closed jankonas closed 3 years ago

jankonas commented 3 years ago

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?