Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function start() {
// close open socket if exists
if(!!ipc.of.klyng_beacon)
ipc.disconnect('klyng_beacon');
var beacon_daemon = cp.spawn('node', ['lib/beacon.js'], {detached: true, stdio: 'ignore'});
beacon_daemon.unref();
return new Promise(function(resolve, reject) {
setTimeout(function() {
checkIfRunning() // this will open a new socket
.then(function(running) {
resolve(running);
});
}, 500);
});
}
after(function() {
ipc.disconnect('auth_socket');
ipc.disconnect('nauth_socket');
tcp.stop();
});
function terminate() {
var debug = debugAllow(false)
try {
ipc.disconnect('main')
} catch(e) {
console.error(e)
}
console.log('closing', traceback())
if(!debug){
win.close(true)
} else {
console.warn('Closing prevented for debugging')
}
}
.then(function(signaled) {
if(signaled) {
if(signaled === 'busy') {
console.log('The beacon is busy.');
ipc.disconnect('klyng_beacon');
}
else {
var remainingProcessesCount = job.size;
ipc.of.klyng_beacon.on('MONITOR:MSG', function(message, socket) {
if(message.type === 'process:stdout') {
console.log(message.data.line);
}
else if(message.type === 'process:exit') {
remainingProcessesCount--;
if(!remainingProcessesCount)
beacon.signalDone()
}
});
ipc.of.klyng_beacon.socket.on('end', function() {
ipc.disconnect('klyng_beacon');
_stop_timeout();
resolve(true);
});
});
disconnect() {
ipc.disconnect(EMBARK);
}
E.uninit = ()=>{
E.uninit_traps();
ipc.disconnect('lum_node_index');
ipc.config.stopRetrying = true;
};
const timer = setTimeout(() => {
ipc.disconnect('renderer')
res({ type: 'Failed', details: 'Timed out.' })
}, 2500)
ipc.connectTo('renderer', WEBCLIPPER_SOCKET_LOCATION, () => {