Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!config.repository) {
console.log(
chalk.red('The "repository" option must be specified in the config file')
)
process.exit(1)
}
const fileLock = path.join(
osTmpdir(),
filenamify(config.repository, { replacement: '-' })
)
// ensure the dir exists, otherwise it's impossible to acquire the lock
if (!fs.existsSync(fileLock)) {
fs.mkdirSync(fileLock)
}
if (fs.existsSync(`${fileLock}.lock`)) {
if (lockfile.checkSync(fileLock)) {
console.log(
chalk.cyan(
`
There is probably another borgjs runnign process.
The look file seems to be locked.
${chalk.yellow(fileLock + '.lock')}
`
)
)
process.exit(1)
}
}
lockfile.lock(fileLock, err => {
if (err) {
console.log(chalk.red(err.message))
if (!config.repository) {
console.log(
chalk.red('The "repository" option must be specified in the config file')
)
process.exit(1)
}
const fileLock = path.join(
osTmpdir(),
filenamify(config.repository, { replacement: '-' })
)
// ensure the dir exists, otherwise it's impossible to acquire the lock
if (!fs.existsSync(fileLock)) {
fs.mkdirSync(fileLock)
}
if (fs.existsSync(`${fileLock}.lock`)) {
if (lockfile.checkSync(fileLock)) {
console.log(
chalk.cyan(
`
lockfile detected.
There is probably another borgjs runnign process.
${chalk.yellow(fileLock + '.lock')}
`
)
)
process.exit(1)
}
}
lockfile.lock(fileLock, err => {
if (err) {
console.log(chalk.red(err.message))