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) {
|
||||
try {
|
||||
const handle = await fs.open(file, "r")
|
||||
try {
|
||||
const relative = path.relative(r("docs"), file)
|
||||
const archive = r(`dist/archive/v${version}/${relative}`)
|
||||
await fs.mkdir(path.dirname(archive), {recursive: true})
|
||||
|
|
@ -158,6 +159,9 @@ async function generate() {
|
|||
createWriteStream(archive)
|
||||
)
|
||||
}
|
||||
} finally {
|
||||
handle.close()
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.code !== "EISDIR") throw e
|
||||
const files = await fs.readdir(file)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue