judge: code wrapper for sysinfo

This commit is contained in:
undefined committed 2022-04-03 15:16:29 +08:00
1 parent 1adf04ae47
commit ef59d79b1a
2 files changed
+4 -1

No files matched your search

+1
View File
@@ -232,6 +232,7 @@ async function postInit() {
this.folder = await cacheOpen(this.source, this.data); this.folder = await cacheOpen(this.source, this.data);
if ((this.code as any).content.startsWith('@@hydro_submission_file@@')) { if ((this.code as any).content.startsWith('@@hydro_submission_file@@')) {
const id = (this.code as any).content.split('@@hydro_submission_file@@')[1]?.split('#')?.[0]; const id = (this.code as any).content.split('@@hydro_submission_file@@')[1]?.split('#')?.[0];
if (!id) throw new SystemError('Submission File Not Found');
const target = await fetchCodeFile(id); const target = await fetchCodeFile(id);
this.code = { src: target }; this.code = { src: target };
this.clean.push(() => fs.remove(target)); this.clean.push(() => fs.remove(target));
+3 -1
View File
@@ -14,7 +14,8 @@ async function stackSize() {
try { try {
const context: Context = { const context: Context = {
lang: 'cc', lang: 'cc',
code: `#include <iostream> code: {
content: `#include <iostream>
using namespace std; using namespace std;
int i=1; int i=1;
int main(){ int main(){
@@ -24,6 +25,7 @@ int main(){
if (i>256) return 0; if (i>256) return 0;
main(); main();
}`, }`,
},
config: { config: {
time: '3s', time: '3s',
memory: '256m', memory: '256m',