How to use the proper-lockfile.unlock function in proper-lockfile

To help you get started, we’ve selected a few proper-lockfile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atomist / sdm-core / lib / internal / preferences / FilePreferenceStore.ts View on Github external
private async doWithPreferenceFile(withPreferenceFile: WithPreferenceFile): Promise {
        await lock(this.filePath, { retries: 5 });
        const prefs = await this.read();
        let result;
        try {
            result = await withPreferenceFile(prefs);
            if (result.save) {
                await fs.writeJson(this.filePath, prefs);
            }
        } catch (e) {
            logger.error(`Operation on preference file failed: ${e.message}`);
        }
        await unlock(this.filePath);
        return result.value as V;
    }
github bbyars / mountebank / src / models / filesystemBackedImpostersRepository.js View on Github external
.catch(err => {
                locker.unlock(filepath, { realpath: false }).catch(unlockErr => {
                    logger.error(`Failed to unlock ${filepath}: ${unlockErr}`);
                });
                return Q.reject(err);
            });
    }
github jspm / jspm-cli / lib / utils / cache.js View on Github external
        await new Promise((resolve, reject) => lockfile.unlock(resolved, {
            realpath: false
        }, err => err ? reject(err) : resolve()));
    }

proper-lockfile

A inter-process and inter-machine lockfile utility that works on a local or network file system

MIT
Latest version published 4 years ago

Package Health Score

74 / 100
Full package analysis