|
|
@ -2,7 +2,7 @@ import colors from 'colors'
|
|
|
|
import { program } from 'commander'
|
|
|
|
import { program } from 'commander'
|
|
|
|
import { setCIMode } from 'clitastic'
|
|
|
|
import { setCIMode } from 'clitastic'
|
|
|
|
|
|
|
|
|
|
|
|
import { unlock, readLock, writeLock } from './lock'
|
|
|
|
import { unlock, readLock, writeLock, lock } from './lock'
|
|
|
|
import { Config } from './types'
|
|
|
|
import { Config } from './types'
|
|
|
|
import { init } from './config'
|
|
|
|
import { init } from './config'
|
|
|
|
import { version } from '../package.json'
|
|
|
|
import { version } from '../package.json'
|
|
|
@ -118,21 +118,19 @@ async function main() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (requireConfig) {
|
|
|
|
if (requireConfig) {
|
|
|
|
config = init(configFile)
|
|
|
|
config = init(configFile)
|
|
|
|
const lock = readLock()
|
|
|
|
const { running } = readLock()
|
|
|
|
if (lock.running) throw new Error('An instance of autorestic is already running for this config file'.red)
|
|
|
|
if (running) {
|
|
|
|
|
|
|
|
console.log('An instance of autorestic is already running for this config file'.red)
|
|
|
|
writeLock({
|
|
|
|
process.exit(1)
|
|
|
|
...lock,
|
|
|
|
}
|
|
|
|
running: true,
|
|
|
|
lock()
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await queue()
|
|
|
|
await queue()
|
|
|
|
if (error) process.exit(1)
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.error(e.message)
|
|
|
|
console.error(e.message)
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
if (requireConfig) unlock()
|
|
|
|
if (requireConfig) unlock()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (error) process.exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
main()
|
|
|
|
main()
|
|
|
|