New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

node-persistent-software

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-persistent-software - npm Package Compare versions

Comparing version
1.1.1
to
1.2.0
+28
-26
lib/main.js

@@ -6,11 +6,12 @@

const spawn = require("child_process").spawn,
events = require("asynchronous-eventemitter");
const spawn = require("child_process").spawn;
// module
module.exports = class PersistantSoftware {
module.exports = class PersistantSoftware extends require("asynchronous-eventemitter") {
constructor(software, args, options) {
super();
this.software = software;

@@ -26,13 +27,4 @@ this.args = ("object" === typeof args && args instanceof Array) ? args : null;

this.eventEmitter = new events().on("eventerror", (err) => {
this.eventEmitter.emit("error", err);
});
}
on(eventName, listener) {
this.eventEmitter.on(eventName, listener);
return this;
}
max(max) {

@@ -65,3 +57,3 @@ this.maxCountRun = max;

this.currentChildProcess.on("error", (err) => {
this.eventEmitter.emit("error", err);
this.emit("error", err);
});

@@ -77,13 +69,13 @@

if (1 < this.successCountRun) {
this.eventEmitter.emit("restart");
this.emit("restart");
}
else {
this.eventEmitter.emit("firststart");
this.emit("firststart");
}
this.eventEmitter.emit("start", this.currentChildProcess);
this.emit("start", this.currentChildProcess);
this.currentChildProcess.on("exit", () => {
this.eventEmitter.emit("stop");
this.emit("stop");

@@ -109,3 +101,3 @@ if (!this.ended) {

catch(e) {
this.eventEmitter.emit("error", e);
this.emit("error", e);
}

@@ -121,15 +113,25 @@

if (this.currentChildProcess && this.currentChildProcess.pid) {
if (this.currentChildProcess) {
try {
process.kill(this.currentChildProcess.pid);
this.eventEmitter.emit("stop");
if (this.currentChildProcess.pid) {
try {
process.kill(this.currentChildProcess.pid);
}
catch (e) {
// nothing to do here
}
}
catch (e) {
// nothing to do here
}
this.currentChildProcess = null;
}
this.eventEmitter.emit("end");
this.emit("end")
.removeAllListeners("start")
.removeAllListeners("firststart")
.removeAllListeners("restart")
.removeAllListeners("stop")
.removeAllListeners("end");

@@ -136,0 +138,0 @@ return this;

{
"name": "node-persistent-software",
"version": "1.1.1",
"version": "1.2.0",
"description": "Spawn a software and keep it running",

@@ -34,16 +34,11 @@ "main": "dist/main.js",

"devDependencies": {
"gulp": "^3.9.1",
"gulp-plumber": "^1.1.0",
"gulp-eslint": "^3.0.1",
"gulp-mocha": "^4.3.1",
"pre-commit": "^1.2.2",
"gulp-babel": "^6.1.2",
"babel-preset-es2015": "^6.24.1"
},
"homepage": "https://github.com/Psychopoulet/node-persistent-software#readme"
}

@@ -11,3 +11,3 @@ # node-persistent-software

## Doc
## Doc (extends : [asynchronous-eventemitter](https://www.npmjs.com/package/asynchronous-eventemitter))

@@ -35,3 +35,2 @@ ### Attributes

* ``` end() : this ``` stop the software and don't restart it
* ``` on(string eventName, function callback) : this ```

@@ -38,0 +37,0 @@ ### Events

@@ -6,4 +6,4 @@

const assert = require("assert"),
PersistantSoftware = require(require("path").join(__dirname, "..", "dist", "main.js"));
const assert = require("assert");
const PersistantSoftware = require(require("path").join(__dirname, "..", "dist", "main.js"));

@@ -10,0 +10,0 @@ // tests