mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: IDE: stderr回显
This commit is contained in:
1 parent
d73ab6833e
commit
bc3fc23ff3
2 files changed
+7
-5
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/hydrojudge",
|
"name": "@hydrooj/hydrojudge",
|
||||||
"bin": "bin/hydrojudge.js",
|
"bin": "bin/hydrojudge.js",
|
||||||
"version": "2.3.1",
|
"version": "2.3.2",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export const judge = async (ctx) => {
|
|||||||
const { code, time_usage_ms, memory_usage_kb } = res;
|
const { code, time_usage_ms, memory_usage_kb } = res;
|
||||||
let { status } = res;
|
let { status } = res;
|
||||||
if (!fs.existsSync(stdout)) fs.writeFileSync(stdout, '');
|
if (!fs.existsSync(stdout)) fs.writeFileSync(stdout, '');
|
||||||
let message: any = fs.readFileSync(stdout).toString() + fs.readFileSync(stderr).toString();
|
const message: string[] = [];
|
||||||
if (status === STATUS.STATUS_ACCEPTED) {
|
if (status === STATUS.STATUS_ACCEPTED) {
|
||||||
if (time_usage_ms > ctx.config.time) {
|
if (time_usage_ms > ctx.config.time) {
|
||||||
status = STATUS.STATUS_TIME_LIMIT_EXCEEDED;
|
status = STATUS.STATUS_TIME_LIMIT_EXCEEDED;
|
||||||
@@ -85,16 +85,18 @@ export const judge = async (ctx) => {
|
|||||||
}
|
}
|
||||||
} else if (code) {
|
} else if (code) {
|
||||||
status = STATUS.STATUS_RUNTIME_ERROR;
|
status = STATUS.STATUS_RUNTIME_ERROR;
|
||||||
if (code < 32) message += signals[code];
|
if (code < 32) message.push(`ExitCode: ${code} (${signals[code]})`);
|
||||||
else message = { message: 'Your program returned {0}.', params: [code] };
|
else message.push(`ExitCode: ${code}`);
|
||||||
}
|
}
|
||||||
|
message.push(fs.readFileSync(stdout).toString());
|
||||||
|
message.push(fs.readFileSync(stderr).toString());
|
||||||
ctx.next({
|
ctx.next({
|
||||||
status,
|
status,
|
||||||
case: {
|
case: {
|
||||||
status,
|
status,
|
||||||
time_ms: time_usage_ms,
|
time_ms: time_usage_ms,
|
||||||
memory_kb: memory_usage_kb,
|
memory_kb: memory_usage_kb,
|
||||||
message,
|
message: message.join('\n'),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
ctx.stat.done = new Date();
|
ctx.stat.done = new Date();
|
||||||
|
|||||||
Reference in new issue
Block a user