judge: checker: testlib: catch errors

This commit is contained in:
undefined committed 2022-11-19 22:08:03 +08:00
1 parent 7461f261dc
commit 5ca9d7689f
1 file changed
+8 -1
+8 -1
View File
@@ -188,7 +188,7 @@ const checkers: Record<string, Checker> = new Proxy({
},
async testlib(config) {
const { stderr, status } = await run(`${config.execute} /w/in /w/user_out /w/answer`, {
const { stderr, status, code } = await run(`${config.execute} /w/in /w/user_out /w/answer`, {
copyIn: {
in: config.input,
user_out: config.user_stdout,
@@ -204,6 +204,13 @@ const checkers: Record<string, Checker> = new Proxy({
message: stderr,
};
}
if (status === STATUS.STATUS_RUNTIME_ERROR) {
return {
status: STATUS.STATUS_WRONG_ANSWER,
score: 0,
message: `Checker exited with code ${code}`,
};
}
return parse(stderr, config.score);
},
}, {