build: use async remove method to handle errors better (#16917)
On windows removeSync randomly seems to fail with DIRNOTEMPTY. By using the async version fs-extra will do some back-off-retry logic to hopefully get this dir deleted
This commit is contained in:
parent
cbd884060e
commit
9e26dfaa06
1 changed files with 9 additions and 5 deletions
|
@ -46,14 +46,18 @@ try {
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Unexpected error while generating ASAR', err)
|
console.error('Unexpected error while generating ASAR', err)
|
||||||
fs.removeSync(tmpPath)
|
fs.remove(tmpPath)
|
||||||
process.exit(1)
|
.then(() => process.exit(1))
|
||||||
|
.catch(() => process.exit(1))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the ASAR archive
|
// Create the ASAR archive
|
||||||
asar.createPackageWithOptions(tmpPath, out[0], {})
|
asar.createPackageWithOptions(tmpPath, out[0], {})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
fs.removeSync(tmpPath)
|
const exit = () => {
|
||||||
console.error('Unexpected error while generating ASAR', err)
|
console.error('Unexpected error while generating ASAR', err)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
|
}
|
||||||
|
fs.remove(tmpPath).then(exit).catch(exit)
|
||||||
}).then(() => fs.remove(tmpPath))
|
}).then(() => fs.remove(tmpPath))
|
||||||
|
|
Loading…
Reference in a new issue