Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions packages/hydrojudge/src/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,15 @@
const outname = params.filename ? `${params.filename}.out` : 'stdout';
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]) {
const hasOutputFileId = Object.prototype.hasOwnProperty.call(ret.fileIds, outname);

Check failure on line 139 in packages/hydrojudge/src/sandbox.ts

View workflow job for this annotation

GitHub Actions / build

Use Object.hasOwn() instead of hasOwnProperty
const hasOutputFile = Object.prototype.hasOwnProperty.call(ret.files, outname);

Check failure on line 140 in packages/hydrojudge/src/sandbox.ts

View workflow job for this annotation

GitHub Actions / build

Use Object.hasOwn() instead of hasOwnProperty
if (hasOutputFileId) ret.fileIds.stdout = ret.fileIds[outname];
if (params.filename && !hasOutputFileId && !hasOutputFile) {
result.error = 'Output file not found';
ret.status = STATUS.STATUS_RUNTIME_ERROR;
}
ret.stdout = ret.files[outname] || '';
ret.stderr = ret.files.stderr || result.error || '';
ret.stdout = ret.files[outname] ?? '';
ret.stderr = ret.files.stderr ?? result.error ?? '';
if (result.error) ret.error = result.error;
return ret;
}
Expand Down Expand Up @@ -250,4 +252,4 @@
return true;
}

export * from './sandbox/interface';
export * from './sandbox/interface';

Check failure on line 255 in packages/hydrojudge/src/sandbox.ts

View workflow job for this annotation

GitHub Actions / build

Newline required at end of file but not found
Loading