1
0
Fork 0
mirror of synced 2024-10-05 20:44:47 +13:00

Fixing an issue with running in dev with prebuilds and fixing an issue with backup questions being asked twice.

This commit is contained in:
mike12345567 2022-07-06 17:42:54 +01:00
parent 228b2506cc
commit bdeb07b42e
2 changed files with 8 additions and 4 deletions

View file

@ -17,7 +17,6 @@ const { exportObjects, importObjects } = require("./objectStore")
async function exportBackup(opts) {
const envFile = opts.env || undefined
await getConfig(envFile)
let filename = opts["export"] || opts
if (typeof filename !== "string") {
filename = `backup-${new Date().toISOString()}.tar.gz`

View file

@ -8,10 +8,10 @@ const PREBUILD_DIR = join(process.execPath, "..", PREBUILDS, ARCH)
checkForBinaries()
function checkForBinaries() {
if (fs.existsSync(PREBUILD_DIR)) {
const readDir = join(__filename, "..", "..", PREBUILDS, ARCH)
if (fs.existsSync(PREBUILD_DIR) || !fs.existsSync(readDir)) {
return
}
const readDir = join(__filename, "..", "..", PREBUILDS, ARCH)
const natives = fs.readdirSync(readDir)
if (fs.existsSync(readDir)) {
fs.mkdirSync(PREBUILD_DIR, { recursive: true })
@ -22,8 +22,13 @@ function checkForBinaries() {
}
}
process.on("exit", () => {
function cleanup() {
if (fs.existsSync(PREBUILD_DIR)) {
fs.rmSync(PREBUILD_DIR, { recursive: true })
}
}
const events = ["exit", "SIGINT", "SIGUSR1", "SIGUSR2", "uncaughtException"]
events.forEach(event => {
process.on(event, cleanup)
})