Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
process.exit(1);
return;
}
const servicePID = storage.getItemSync(serviceName);
let serviceStopped = false;
if (servicePID !== null) {
try {
execSync(`kill -9 ${servicePID} > /dev/null 2>&1`);
serviceStopped = true;
} catch (err) {
// NOOP
}
}
storage.removeItemSync(serviceName);
return serviceStopped;
}
const stopService = serviceId => {
const servicePID = storage.getItemSync(serviceId);
if (servicePID !== null) {
try {
execSync(`kill -9 ${servicePID} > /dev/null 2>&1`);
} catch (err) {
// NOOP
}
}
storage.removeItemSync(serviceId);
};
get: function(key) {
var obj = storage.getItemSync(key);
if (obj) {
var ttl = obj.ttl;
var timestamp = obj.timestamp;
// if not ttl => return obj
if (ttl === -1) {
return obj.data;
} else {
// check ttl
var now = new Date().getTime();
if (now - timestamp < ttl) {
return obj.data;
} else {
storage.removeItemSync(key, function() {});
}
}
}
},
remove = () => {
var key = AccessoryInfo.persistKey(this.username);
storage.removeItemSync(key);
}
function clearLightStateForLightId(lightId)
{
if (storage === null || storage === undefined) {
RED.log.warn("storage is null in clearLightStateForLightId");
return;
}
if (lightId === null || lightId === undefined) {
RED.log.warn("lightId is null");
return null;
}
var key = formatUUID(lightId) + "_state";
storage.removeItemSync(key);
}
}
remove = () => {
var key = IdentifierCache.persistKey(this.username);
storage.removeItemSync(key);
}