[Pkg-javascript-commits] [node-proper-lockfile] 01/04: New upstream version 2.0.1
Paolo Greppi
paolog-guest at moszumanska.debian.org
Mon Jul 3 07:25:26 UTC 2017
This is an automated email from the git hooks/post-receive script.
paolog-guest pushed a commit to branch master
in repository node-proper-lockfile.
commit c96642fddc33f66dc7ec800dc0e1dcaf5807a90d
Author: Paolo Greppi <paolo.greppi at libpf.com>
Date: Mon Jul 3 09:18:35 2017 +0200
New upstream version 2.0.1
---
.npmignore | 2 ++
README.md | 8 ++++----
index.js | 8 +++++++-
package.json | 2 +-
test/test.js | 4 +++-
5 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..876ce25
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,2 @@
+.*
+test
diff --git a/README.md b/README.md
index c2f4ea6..427e0ea 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@
[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-proper-lockfile#info=devDependencies
[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-proper-lockfile.svg
-A inter-process and inter-machine lockfile utility that works on a local or network file system.
+An inter-process and inter-machine lockfile utility that works on a local or network file system.
## Installation
@@ -82,7 +82,7 @@ Available options:
```js
const lockfile = require('proper-lockfile');
-lockfile.lock('some/file', (err) => {
+lockfile.lock('some/file', (err, release) => {
if (err) {
throw err; // Lock failed
}
@@ -94,7 +94,7 @@ lockfile.lock('some/file', (err) => {
// Note that you can optionally handle release errors
// Though it's not mandatory since it will eventually stale
- /*release(function (err) {
+ /*release((err) => {
// At this point the lock was effectively released or an error
// occurred while removing it
if (err) {
@@ -131,7 +131,7 @@ lockfile.lock('some/file', (err) => {
lockfile.unlock('some/file');
// or..
- /*lockfile.unlock('some/file', function (err) {
+ /*lockfile.unlock('some/file', (err) => {
// At this point the lock was effectively released or an error
// occurred while removing it
if (err) {
diff --git a/index.js b/index.js
index 6793fd0..0f065f1 100644
--- a/index.js
+++ b/index.js
@@ -135,7 +135,13 @@ threshold'), { code: 'ECOMPROMISED' }));
// Unref the timer so that the nodejs process can exit freely
// This is safe because all acquired locks will be automatically released
// on process exit
- lock.updateTimeout.unref();
+
+ // We first check that `lock.updateTimeout.unref` exists because some users
+ // may be using this module outside of NodeJS (e.g., in an electron app),
+ // and in those cases `setTimeout` return an integer.
+ if (lock.updateTimeout.unref) {
+ lock.updateTimeout.unref();
+ }
}
function compromisedLock(file, lock, err) {
diff --git a/package.json b/package.json
index b149a56..609b019 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "proper-lockfile",
- "version": "2.0.0",
+ "version": "2.0.1",
"description": "A inter-process and inter-machine lockfile utility that works on a local or network file system.",
"main": "index.js",
"scripts": {
diff --git a/test/test.js b/test/test.js
index e1b9685..b2e241b 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1101,10 +1101,12 @@ describe('misc', () => {
spawn('node', [`${__dirname}/fixtures/stress.js`], (err, stdout) => {
if (err) {
+ stdout = stdout || '';
+
if (process.env.TRAVIS) {
process.stdout.write(stdout);
} else {
- fs.writeFileSync(`${__dirname}/stress.log`, stdout || '');
+ fs.writeFileSync(`${__dirname}/stress.log`, stdout);
}
return next(err);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-proper-lockfile.git
More information about the Pkg-javascript-commits
mailing list