Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function cleanup (ipfsd) {
const log = logger.start('[daemon] cleanup')
if (!await fs.pathExists(configPath(ipfsd))) {
cannotConnectDialog(ipfsd.apiAddr)
throw new Error('cannot tonnect to api')
}
log.info('run: ipfs repo fsck')
const exec = findExecutable('go', app.getAppPath())
try {
execFileSync(exec, ['repo', 'fsck'], {
env: {
...process.env,
IPFS_PATH: ipfsd.repoPath
}
})
log.end()
} catch (err) {
log.fail(err)
}
}
async function cleanup (addr, path) {
logger.info('[daemon] cleanup: started')
if (!await fs.pathExists(join(path, 'config'))) {
cannotConnectDialog(addr)
throw new Error('cannot tonnect to api')
}
logger.info(`[daemon] cleanup: ipfs repo fsck ${path}`)
const exec = findExecutable('go', app.getAppPath())
try {
execFileSync(exec, ['repo', 'fsck'], {
env: {
...process.env,
IPFS_PATH: path
}
})
logger.info('[daemon] cleanup: completed')
} catch (err) {
logger.error(`[daemon] ${err.toString()}`)
}
}