Remember to close file handle [skip ci]
This commit is contained in:
parent
0d10dc2c89
commit
615a9364f0
1 changed files with 20 additions and 16 deletions
|
|
@ -140,6 +140,7 @@ async function generate() {
|
||||||
async function generate(file) {
|
async function generate(file) {
|
||||||
try {
|
try {
|
||||||
const handle = await fs.open(file, "r")
|
const handle = await fs.open(file, "r")
|
||||||
|
try {
|
||||||
const relative = path.relative(r("docs"), file)
|
const relative = path.relative(r("docs"), file)
|
||||||
const archive = r(`dist/archive/v${version}/${relative}`)
|
const archive = r(`dist/archive/v${version}/${relative}`)
|
||||||
await fs.mkdir(path.dirname(archive), {recursive: true})
|
await fs.mkdir(path.dirname(archive), {recursive: true})
|
||||||
|
|
@ -158,6 +159,9 @@ async function generate() {
|
||||||
createWriteStream(archive)
|
createWriteStream(archive)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
handle.close()
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.code !== "EISDIR") throw e
|
if (e.code !== "EISDIR") throw e
|
||||||
const files = await fs.readdir(file)
|
const files = await fs.readdir(file)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue