Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "terminate", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Terminate a Node.js Process based on the Process ID", | ||
@@ -5,0 +5,0 @@ "main": "terminate.js", |
# terminate | ||
Terminate a Node.js Process based on the Process ID | ||
A reliable (tested) way to **Terminate** a **Node.js Process** (and ***all Child Processes***) based on the **Process ID** | ||
![terminate-the-node-process-final](https://cloud.githubusercontent.com/assets/194400/6859420/a3b63f3c-d410-11e4-91bb-ad6b607cc465.png) | ||
@@ -15,4 +16,25 @@ | ||
## Usage | ||
### Install from NPM | ||
```sh | ||
npm install terminate --save | ||
``` | ||
### In your script | ||
```js | ||
var terminate = require('terminate'); | ||
terminate(process.pid, function(err, done){ | ||
if(err) { // you will get an error if you did not supply a valid process.pid | ||
console.log("Oopsy: " + err); // handle errors in your preferred way. | ||
} | ||
else { | ||
console.log(done); // do what you do best! | ||
} | ||
}) | ||
``` | ||
<br /> | ||
@@ -22,2 +44,10 @@ | ||
## Why? | ||
In our [***Faster***](https://github.com/ideaq/faster) project | ||
we run the server using a child process. | ||
When we want to re-start the server, | ||
we needed to ensure the **process** (and any **Child Processes**) | ||
were **Terminate**ed before re-start. | ||
## Research | ||
@@ -24,0 +54,0 @@ |
11114
106