mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
judge: capture lemon checker error
This commit is contained in:
1 parent
9219bbfc24
commit
510eff9dbb
1 file changed
+11
-5
@@ -119,21 +119,27 @@ const checkers: Record<string, Checker> = new Proxy({
|
||||
* argv[6]:输出错误报告的文件
|
||||
*/
|
||||
async lemon(config) {
|
||||
const { files } = await run(`${config.execute} input usrout answer ${config.score} score message`, {
|
||||
const { files, code } = await run(`${config.execute} input usrout answer ${config.score} score message`, {
|
||||
copyIn: {
|
||||
usrout: config.user_stdout,
|
||||
answer: config.output,
|
||||
input: config.input,
|
||||
...config.copyIn,
|
||||
},
|
||||
copyOut: ['score', 'message'],
|
||||
copyOut: ['score?', 'message?'],
|
||||
env: config.env,
|
||||
});
|
||||
const { message } = files;
|
||||
const score = parseInt(files.score, 10);
|
||||
if (code) {
|
||||
return {
|
||||
score: 0,
|
||||
message: `Checker returned with status ${code}`,
|
||||
status: STATUS.STATUS_SYSTEM_ERROR,
|
||||
};
|
||||
}
|
||||
const score = Math.floor(+files.score) || 0;
|
||||
return {
|
||||
score,
|
||||
message,
|
||||
message: files.message,
|
||||
status: score === config.score
|
||||
? STATUS.STATUS_ACCEPTED
|
||||
: STATUS.STATUS_WRONG_ANSWER,
|
||||
|
||||
Reference in new issue
Block a user