mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: import.syzoj: del tmp file
This commit is contained in:
1 parent
4d9a7a6bb4
commit
3dcc6d2aa2
2 files changed
+5
-1
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.15.28",
|
"version": "2.15.29",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ class ProblemImportSYZOJHandler extends Handler {
|
|||||||
const r = download(`${url}testdata/download`);
|
const r = download(`${url}testdata/download`);
|
||||||
const file = path.resolve(os.tmpdir(), 'hydro', `import_${domainId}_${docId}.zip`);
|
const file = path.resolve(os.tmpdir(), 'hydro', `import_${domainId}_${docId}.zip`);
|
||||||
const w = fs.createWriteStream(file);
|
const w = fs.createWriteStream(file);
|
||||||
|
try {
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
w.on('finish', resolve);
|
w.on('finish', resolve);
|
||||||
w.on('error', reject);
|
w.on('error', reject);
|
||||||
@@ -122,6 +123,9 @@ class ProblemImportSYZOJHandler extends Handler {
|
|||||||
type: p.type === 'traditional' ? 'default' : p.type,
|
type: p.type === 'traditional' ? 'default' : p.type,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
|
fs.unlinkSync(file);
|
||||||
|
}
|
||||||
return docId;
|
return docId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user