mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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]:输出错误报告的文件
|
* argv[6]:输出错误报告的文件
|
||||||
*/
|
*/
|
||||||
async lemon(config) {
|
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: {
|
copyIn: {
|
||||||
usrout: config.user_stdout,
|
usrout: config.user_stdout,
|
||||||
answer: config.output,
|
answer: config.output,
|
||||||
input: config.input,
|
input: config.input,
|
||||||
...config.copyIn,
|
...config.copyIn,
|
||||||
},
|
},
|
||||||
copyOut: ['score', 'message'],
|
copyOut: ['score?', 'message?'],
|
||||||
env: config.env,
|
env: config.env,
|
||||||
});
|
});
|
||||||
const { message } = files;
|
if (code) {
|
||||||
const score = parseInt(files.score, 10);
|
return {
|
||||||
|
score: 0,
|
||||||
|
message: `Checker returned with status ${code}`,
|
||||||
|
status: STATUS.STATUS_SYSTEM_ERROR,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const score = Math.floor(+files.score) || 0;
|
||||||
return {
|
return {
|
||||||
score,
|
score,
|
||||||
message,
|
message: files.message,
|
||||||
status: score === config.score
|
status: score === config.score
|
||||||
? STATUS.STATUS_ACCEPTED
|
? STATUS.STATUS_ACCEPTED
|
||||||
: STATUS.STATUS_WRONG_ANSWER,
|
: STATUS.STATUS_WRONG_ANSWER,
|
||||||
|
|||||||
Reference in new issue
Block a user