mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: sandbox: check output existance for fileio
This commit is contained in:
3 files changed
+5
-9
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/hydrojudge",
|
"name": "@hydrooj/hydrojudge",
|
||||||
"bin": "bin/hydrojudge.js",
|
"bin": "bin/hydrojudge.js",
|
||||||
"version": "3.1.24",
|
"version": "3.1.25",
|
||||||
"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",
|
||||||
|
|||||||
@@ -33,14 +33,6 @@ export class FormatError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RuntimeError extends Error {
|
|
||||||
type = 'RuntimeError';
|
|
||||||
|
|
||||||
constructor(public detail: string, message: string) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SystemError extends Error {
|
export class SystemError extends Error {
|
||||||
type = 'SystemError';
|
type = 'SystemError';
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,10 @@ async function adaptResult(result: SandboxResult, params: Parameter): Promise<Sa
|
|||||||
ret.files = result.files || {};
|
ret.files = result.files || {};
|
||||||
ret.fileIds = result.fileIds || {};
|
ret.fileIds = result.fileIds || {};
|
||||||
if (ret.fileIds[outname]) ret.fileIds.stdout = ret.fileIds[outname];
|
if (ret.fileIds[outname]) ret.fileIds.stdout = ret.fileIds[outname];
|
||||||
|
if (params.filename && !ret.fileIds[outname] && !ret.files[outname]) {
|
||||||
|
result.error = 'Output file not found';
|
||||||
|
ret.status = STATUS.STATUS_RUNTIME_ERROR;
|
||||||
|
}
|
||||||
ret.stdout = ret.files[outname] || '';
|
ret.stdout = ret.files[outname] || '';
|
||||||
ret.stderr = ret.files.stderr || result.error || '';
|
ret.stderr = ret.files.stderr || result.error || '';
|
||||||
if (result.error) ret.error = result.error;
|
if (result.error) ret.error = result.error;
|
||||||
|
|||||||
Reference in new issue
Block a user