Skip to content
This repository was archived by the owner on Nov 8, 2020. It is now read-only.

Commit 4db54fd

Browse files
committed
signalled?
1 parent 70f99cf commit 4db54fd

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

judger/check.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const checkers = require('./checkers');
22
const { SystemError } = require('./error');
33

44
async function check(config) {
5-
if (!checkers[config.checker_type]) { throw new SystemError(`未知比较器类型:${config.checker_type}`); }
5+
if (!checkers[config.checker_type]) throw new SystemError(`未知比较器类型:${config.checker_type}`);
66
const {
77
code, status, score, message,
88
} = await checkers[config.checker_type].check({

judger/hosts/hydro.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class Hydro {
177177

178178
async consume(queue) {
179179
setInterval(async () => {
180-
const res = await this.axios.get('/judge/fetch');
180+
const res = await this.axios.get('/judge');
181181
console.log(res.data);
182182
if (res.data.task) queue.push(new JudgeTask(this, res.data.task));
183183
}, 1000);
@@ -201,7 +201,7 @@ class Hydro {
201201
}
202202

203203
async ensureLogin() {
204-
const res = await this.axios.get('/judge/noop');
204+
const res = await this.axios.get('/judge?check=true');
205205
if (res.data.error) await this.login();
206206
}
207207

judger/sandbox/executionServer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const {
66
const { SystemError } = require('../error');
77
const status = require('../status');
88
const { cmd } = require('../utils');
9+
const { STATUS_ACCEPTED } = require('../status');
910

1011
const fsp = fs.promises;
1112
const env = ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'HOME=/w'];
@@ -20,6 +21,7 @@ const statusMap = {
2021
'Nonzero Exit Status': status.STATUS_RUNTIME_ERROR,
2122
'Internal Error': status.STATUS_SYSTEM_ERROR,
2223
'File Error': status.STATUS_SYSTEM_ERROR,
24+
Signalled: status.STATUS_RUNTIME_ERROR,
2325
};
2426

2527
function proc({
@@ -93,8 +95,9 @@ async function run(execute, params) {
9395
} catch (e) {
9496
throw new SystemError('Cannot connect to sandbox service');
9597
}
98+
// FIXME: Signalled?
9699
const ret = {
97-
status: statusMap[result.status],
100+
status: statusMap[result.status] || STATUS_ACCEPTED,
98101
time_usage_ms: result.time / 1000000,
99102
memory_usage_kb: result.memory / 1024,
100103
files: result.files,

0 commit comments

Comments
 (0)