mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-21 01:46:28 +08:00
judge: add stack size report
This commit is contained in:
4 files changed
+50
-18
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { LangConfig } from '@hydrooj/utils/lib/lang';
|
||||
import { runQueued } from './sandbox';
|
||||
|
||||
export async function compilerVersions(langs: Record<string, LangConfig>) {
|
||||
const result = {};
|
||||
for (const lang in langs) {
|
||||
const version = langs[lang].version;
|
||||
if (!version) continue;
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const res = await runQueued(version, {
|
||||
copyIn: {},
|
||||
time: 10000,
|
||||
memory: 256,
|
||||
}, 'compilerVersions', 5);
|
||||
result[lang] = `${res.stdout}\n${res.stderr}`.trim();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function stackSize() {
|
||||
const res = await runQueued('/bin/bash -c "ulimit -s"', {
|
||||
copyIn: {},
|
||||
time: 10000,
|
||||
memory: 256,
|
||||
}, 'stackSize', 5);
|
||||
if (res.stderr) return -1;
|
||||
return +res.stdout;
|
||||
}
|
||||
Reference in new issue
Block a user