mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-12-22 16:26:25 +00:00
lock only if config required
This commit is contained in:
parent
878a7bd752
commit
7e6cc7bb32
@ -115,6 +115,8 @@ if (ci) colors.disable()
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
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)
|
||||
|
||||
@ -122,14 +124,14 @@ async function main() {
|
||||
...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…
Reference in New Issue
Block a user