Skip to content

Commit a87f4dd

Browse files
authored
check_parameters.php: Make the script's retval reflect errors
When the check_parameters.php script meets an error it prints it out but the exit value is not affected, it's still 0. This does not fly with projects that want to run this script as a part of their test suite. Therefore, make the script return 0 on success and 2 if any error was reported. Signed-off-by: Michal Privoznik <[email protected]> Closes GH-8790.
1 parent f25afaf commit a87f4dd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/dev/check_parameters.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
/** reports an error, according to its level */
5252
function error($str, $level = 0)
5353
{
54-
global $current_file, $current_function, $line;
54+
global $current_file, $current_function, $line, $error_reported;
5555

5656
if ($level <= REPORT_LEVEL) {
5757
if (strpos($current_file,PHPDIR) === 0) {
@@ -60,6 +60,7 @@ function error($str, $level = 0)
6060
$filename = $current_file;
6161
}
6262
echo $filename , " [$line] $current_function : $str\n";
63+
$error_reported = true;
6364
}
6465
}
6566

@@ -372,6 +373,9 @@ function recurse($path)
372373
}
373374
}
374375

376+
$error_reported = false;
375377
foreach ($dirs as $dir) {
376378
recurse(realpath($dir));
377379
}
380+
381+
exit($error_reported === false ? 0 : 2);

0 commit comments

Comments
 (0)