mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
judge: fix temp dir resolve
This commit is contained in:
1 parent
a8111c2ecc
commit
5dfb81c6c3
3 files changed
+3
-3
No files matched your search
@@ -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
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in new issue
Block a user