Skip to content

Commit fb1948a

Browse files
committed
Improve internal error when the compare script errors.
This will include the exit code in the description of the internal error in order to make it more clear, as well as include the metadata.
1 parent 0c5ae90 commit fb1948a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

judge/judgedaemon.main.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,13 +1467,19 @@ function judge(array $judgeTask): bool
14671467
}
14681468

14691469
if ($result === 'compare-error') {
1470+
$compareMeta = read_metadata($passdir . '/compare.meta');
1471+
$compareExitCode = 'n/a';
1472+
if (isset($compareMeta['exitcode'])) {
1473+
$compareExitCode = $compareMeta['exitcode'];
1474+
}
14701475
if ($combined_run_compare) {
14711476
logmsg(LOG_ERR, "comparing failed for combined run/compare script '" . $judgeTask['run_script_id'] . "'");
1472-
$description = 'combined run/compare script ' . $judgeTask['run_script_id'] . ' crashed';
1477+
$description = 'combined run/compare script ' . $judgeTask['run_script_id'] . ' crashed with exit code ' . $compareExitCode . ", expected one of 42/43";
14731478
disable('run_script', 'run_script_id', $judgeTask['run_script_id'], $description, $judgeTask['judgetaskid']);
14741479
} else {
14751480
logmsg(LOG_ERR, "comparing failed for compare script '" . $judgeTask['compare_script_id'] . "'");
1476-
$description = 'compare script ' . $judgeTask['compare_script_id'] . ' crashed';
1481+
logmsg(LOG_ERR, "compare script meta data:\n" . dj_file_get_contents($passdir . '/compare.meta'));
1482+
$description = 'compare script ' . $judgeTask['compare_script_id'] . ' crashed with exit code ' . $compareExitCode . ", expected one of 42/43";
14771483
disable('compare_script', 'compare_script_id', $judgeTask['compare_script_id'], $description, $judgeTask['judgetaskid']);
14781484
}
14791485
return false;

0 commit comments

Comments
 (0)