Showing error context from the build log when error condition is triggered
This commit is contained in:
parent
a73cc632d4
commit
ac3122efed
|
@ -1013,8 +1013,9 @@ function watch_running_process($pid, $log_file, $exit_matches = array(), $error_
|
||||||
{
|
{
|
||||||
foreach($matches as $match)
|
foreach($matches as $match)
|
||||||
{
|
{
|
||||||
if(strpos($buffer, $match) !== false)
|
$match_idx = strpos($buffer, $match);
|
||||||
return true;
|
if($match_idx !== false)
|
||||||
|
return $match_idx;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
@ -1042,18 +1043,22 @@ function watch_running_process($pid, $log_file, $exit_matches = array(), $error_
|
||||||
echo $buffer;
|
echo $buffer;
|
||||||
|
|
||||||
//log success condition
|
//log success condition
|
||||||
if($matches_any_fn($buffer, $exit_matches))
|
if($matches_any_fn($buffer, $exit_matches) !== false)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if($matches_any_fn($buffer, $noted_warnings))
|
if($matches_any_fn($buffer, $noted_warnings) !== false)
|
||||||
$warnings_list[] = $buffer;
|
$warnings_list[] = $buffer;
|
||||||
|
|
||||||
if($matches_any_fn($buffer, $error_matches))
|
$buffer_error_idx = $matches_any_fn($buffer, $error_matches);
|
||||||
|
if($buffer_error_idx !== false)
|
||||||
{
|
{
|
||||||
if($matches_any_fn($buffer, $ignored_errors))
|
if($matches_any_fn($buffer, $ignored_errors) !== false)
|
||||||
echo "Error in log file IGNORED\n";
|
echo "Error in log file IGNORED\n";
|
||||||
else
|
else
|
||||||
$throw_fn("Error condition in log file detected");
|
$throw_fn("Error condition in log file '$log_file' detected:\n****\n" .
|
||||||
|
trim(substr($buffer, $buffer_error_idx, 300))
|
||||||
|
. "\n****\n"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($process_gone)
|
else if($process_gone)
|
||||||
|
|
Loading…
Reference in New Issue