lock only if config required

pull/38/head
cupcakearmy 4 years ago
parent 878a7bd752
commit 7e6cc7bb32
No known key found for this signature in database
GPG Key ID: D28129AE5654D9D9

@ -115,21 +115,23 @@ if (ci) colors.disable()
async function main() {
try {
const lock = readLock()
if (lock.running) throw new Error('An instance of autorestic is already running for this config file'.red)
if (requireConfig) {
config = init(configFile)
const lock = readLock()
if (lock.running) throw new Error('An instance of autorestic is already running for this config file'.red)
writeLock({
...lock,
running: true,
})
writeLock({
...lock,
running: true,
})
}
if (requireConfig) config = init(configFile)
await queue()
if (error) process.exit(1)
} catch (e) {
console.error(e.message)
} finally {
unlock()
if (requireConfig) unlock()
}
}
main()

Loading…
Cancel
Save