mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +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",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "3.1.24",
|
||||
"version": "3.1.25",
|
||||
"main": "package.json",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"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 {
|
||||
type = 'SystemError';
|
||||
|
||||
|
||||
@@ -126,6 +126,10 @@ async function adaptResult(result: SandboxResult, params: Parameter): Promise<Sa
|
||||
ret.files = result.files || {};
|
||||
ret.fileIds = result.fileIds || {};
|
||||
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.stderr = ret.files.stderr || result.error || '';
|
||||
if (result.error) ret.error = result.error;
|
||||
|
||||
Reference in new issue
Block a user