Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

forkie

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

forkie - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

examples/failed-worker.js

11

examples/master.js

@@ -7,4 +7,6 @@ // run with examples/master.js

var unstoppableWorker = path.join(__dirname, 'unstoppable-worker.js');
var failedWorker = path.join(__dirname, 'failed-worker.js');
require('log-prefix')('MASTER PID/' + process.pid + ' says:');
var masterLog;
var master = forkie.master([

@@ -16,5 +18,9 @@ workerFile,

// should be killed with SIGKILL
unstoppableWorker
unstoppableWorker,
failedWorker
], {
start: function(cb) {
masterLog = setInterval(function() {
console.log('master is alive')
}, 250);
console.log('will start workers in 500ms');

@@ -24,2 +30,3 @@ setTimeout(cb, 500);

stop: function(cb) {
clearInterval(masterLog);
console.log('will stop workers in 200ms');

@@ -26,0 +33,0 @@ setTimeout(cb, 200)

12

lib/master.js

@@ -19,4 +19,4 @@ 'use strict';

var worker = worker('master process', {
start: async.compose(start, opts.start),
stop: async.compose(stop, opts.stop),
start: async.series.bind(async, [opts.start, start]),
stop: async.series.bind(async, [opts.stop, stop])
});

@@ -42,6 +42,10 @@

function waitForExit(proc, cb) {
if (proc.connected !== true) {
return process.nextTick(cb);
}
var forceKill = proc.kill.bind(proc, 'SIGKILL');
var killTimeout = setTimeout(forceKill, opts.killTimeout);
proc.once('exit', workerExited);
proc.addListener('exit', workerExited);

@@ -83,3 +87,3 @@ function workerExited(code, signal) {

function startFork(forkedProcess, cb) {
forkedProcess.on('message', handleWorkerMessage);
forkedProcess.addListener('message', handleWorkerMessage);

@@ -86,0 +90,0 @@ function handleWorkerMessage(msg) {

{
"name": "forkie",
"version": "0.1.0",
"version": "0.1.1",
"description": "forkie likes your forks",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc