judge: fix temp dir resolve

This commit is contained in:
undefined committed 2022-09-06 13:02:46 +08:00
1 parent a8111c2ecc
commit 5dfb81c6c3
3 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ tmp_dir:
type: text
name: tmp_dir
desc: Temp directory
default: $TEMP/hydro/judge.tmp
default: $TEMP/hydro/judge
tmpfs_size:
type: text
name: tmpfs_size
+1 -1
View File
@@ -21,7 +21,7 @@ const session = {
config: { detail: system.get('hydrojudge.detail') },
async fetchFile(name: string) {
name = name.split('#')[0];
const target = path.join('/tmp/hydro/judge', name.replace(/\//g, '_'));
const target = path.join(getConfig('tmp_dir'), name.replace(/\//g, '_'));
await storage.get(`submission/${name}`, target);
return target;
},
+1 -1
View File
@@ -112,7 +112,7 @@ export default class Hydro {
async fetchFile(name: string) {
name = name.split('#')[0];
const res = await this.post('judge/code', { id: name });
const target = path.join('/tmp/hydro/judge', name.replace(/\//g, '_'));
const target = path.join(getConfig('tmp_dir'), name.replace(/\//g, '_'));
const w = fs.createWriteStream(target);
this.get(res.body.url).pipe(w);
await new Promise((resolve, reject) => {