Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
additionalFlags: [
'--window-size=1020,720',
'--disable-gpu',
'--headless'
]
});
return launcher.run().then(() => launcher)
.catch(err => {
return launcher.kill().then(() => { // Kill Chrome if there's an error.
throw err;
}, console.error);
});
}
lockfile.lock(output+'.lock', function(err) {
if (err) {
// Another process is already working on this. Just wait until it's finished.
console.log("Waiting for other process")
lockfile.lock(output+'.lock', { wait: timeout }, function(err) {
process.exit(0)
})
} else {
run().catch(e => {
if (e.code == "ECONNREFUSED") {
launchChrome().then(run).catch(e => {
console.error(e);
process.exit(1);
})
} else {
console.error(e);
process.exit(1);
initialize: function(updateInterval, callback) {
this.updateInterval = updateInterval;
this.updateCallback = callback;
// Perform a lock while updating the cache to ensure only one process
// is updating the cache at a time.
lockFile.lock(this.cacheLockPath, { stale: 60 * 1000 }, function(error) {
if(error) {
this.finish(null, cache);
return true;
}
fs.stat(this.cachePath, this.handleFileStat.bind(this));
}.bind(this));
},
return new Promise(function (resolve, reject) {
var lockPath = getLockPath(file);
/* eslint-disable consistent-return */
lockfile.lock(lockPath, function (err) {
if (err) {
return reject(err);
}
resolve();
});
});
};
return new Promise(function (resolve, reject) {
var lockPath = getLockPath(file);
/* eslint-disable consistent-return */
lockfile.unlock(lockPath, function (err) {
if (err) {
return reject(err);
}
resolve();
});
});
};
fs.appendFile(analyticsFile,temp,function (err,result){
if(err){
logs =temp+logs;
num_rows +=currentNrOfRows
}
lockFile.unlock(analyticsFile + ".lock", function (err) {
if (err) {
console.error("Analytics error on unlocking!", err);
}
});
});
}
var unlock = function() {
lockfile.unlock(lockFile, function(error) {
if (error) {
console.error(error);
}
});
};
store.close = function close(returnError) {
jsonpatch.unobserve(store.data, observer);
lockFile.unlock(storePath + LOCK_FILE_EXTENSION, function (error) {
if (error) {
error.stacktrace = new Error().stack;
store.emit('error', error);
if (returnError) { returnError(error); } else { throw error; }
return;
}
store.emit('closed');
returnError && returnError();
});
};
function then () {
var opts = { stale: npm.config.get("cache-lock-stale")
, retries: npm.config.get("cache-lock-retries")
, wait: npm.config.get("cache-lock-wait") }
var lf = lockFileName(u)
log.verbose("lock", u, lf)
lockFile.lock(lf, opts, function(er) {
if (!er) myLocks[lf] = true
cb(er)
})
}
}
function then () {
var opts = { stale: npm.config.get("cache-lock-stale")
, retries: npm.config.get("cache-lock-retries")
, wait: npm.config.get("cache-lock-wait") }
var lf = lockFileName(u)
log.verbose("lock", u, lf)
lockFile.lock(lf, opts, function(er) {
if (!er) myLocks[lf] = true
cb(er)
})
}
}
getCacheStat(function (er, cs) {
if (er) return cb(er)
var opts = { stale: npm.config.get("cache-lock-stale")
, retries: npm.config.get("cache-lock-retries")
, wait: npm.config.get("cache-lock-wait") }
var lf = lockFileName(u)
log.verbose("lock", u, lf)
lockFile.lock(lf, opts, function(er) {
if (!er) myLocks[lf] = true
cb(er)
})
})
}