mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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
|
type: text
|
||||||
name: tmp_dir
|
name: tmp_dir
|
||||||
desc: Temp directory
|
desc: Temp directory
|
||||||
default: $TEMP/hydro/judge.tmp
|
default: $TEMP/hydro/judge
|
||||||
tmpfs_size:
|
tmpfs_size:
|
||||||
type: text
|
type: text
|
||||||
name: tmpfs_size
|
name: tmpfs_size
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const session = {
|
|||||||
config: { detail: system.get('hydrojudge.detail') },
|
config: { detail: system.get('hydrojudge.detail') },
|
||||||
async fetchFile(name: string) {
|
async fetchFile(name: string) {
|
||||||
name = name.split('#')[0];
|
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);
|
await storage.get(`submission/${name}`, target);
|
||||||
return target;
|
return target;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export default class Hydro {
|
|||||||
async fetchFile(name: string) {
|
async fetchFile(name: string) {
|
||||||
name = name.split('#')[0];
|
name = name.split('#')[0];
|
||||||
const res = await this.post('judge/code', { id: name });
|
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);
|
const w = fs.createWriteStream(target);
|
||||||
this.get(res.body.url).pipe(w);
|
this.get(res.body.url).pipe(w);
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
|
|||||||
Reference in new issue
Block a user