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

terminate

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terminate - npm Package Compare versions

Comparing version 2.5.0 to 2.6.0

4

package.json
{
"name": "terminate",
"version": "2.5.0",
"version": "2.6.0",
"description": "Terminate a Node.js Process based on the Process ID",

@@ -42,3 +42,3 @@ "main": "terminate.js",

"chalk": "^1.1.1",
"goodparts": "1.2.1",
"goodparts": "1.3.0",
"jshint": "^2.9.6",

@@ -45,0 +45,0 @@ "nyc": "^15.1.0",

@@ -9,4 +9,4 @@ # terminate

[![codecov.io](https://codecov.io/github/dwyl/terminate/coverage.svg?branch=master)](https://codecov.io/github/dwyl/terminate?branch=master)
[![npm version](https://badge.fury.io/js/terminate.svg)](http://badge.fury.io/js/terminate)
[![Node.js Version](https://img.shields.io/node/v/terminate.svg?style=flat)](http://nodejs.org/download)
[![npm version](https://badge.fury.io/js/terminate.svg)](https://badge.fury.io/js/terminate)
[![Node.js Version](https://img.shields.io/node/v/terminate.svg?style=flat)](https://nodejs.org/download)
[![Dependency Status](https://david-dm.org/dwyl/terminate.svg)](https://david-dm.org/dwyl/terminate)

@@ -46,2 +46,16 @@ [![JavaScript Style Guide: Good Parts](https://img.shields.io/badge/code%20style-goodparts-brightgreen.svg?style=flat)](https://github.com/dwyl/goodparts "JavaScript The Good Parts")

```ts
// Function signature
terminate(pid: number, signal?: string, opts?: TerminateOptions, callback?: DoneCallback): void
// Function signature of the Promise version
terminate(pid: number, signal?: string, opts?: TerminateOptions): Promise<void>
```
- `pid` - The Process ID you want to terminate.
- `signal` - The signal to kill the processes with. Defaults to `"SIGKILL"` if it's empty or not defined.
- `opts.pollInterval` - Interval to poll whether `pid` and all of the childs pids have been killed. Defaults to `500` (0.5s).
- `opts.timeout` - Max time (in milliseconds) to wait for process to exit before timing out and calling back with an error. Defaults to `5000` (5s).
- `callback` - The callback function to call when the termination is done. It has this signature: `(error: Error | null): void` whereas `error` will be `null` if the operation succeeds.
#### Promise API

@@ -81,3 +95,3 @@

and don't want to "waste" the CPU by only using *one* of those cores
(remember: one of Node's *selling points* is that its [single-process running on a single-core](http://stackoverflow.com/questions/17959663/)),
(remember: one of Node's *selling points* is that its [single-process running on a single-core](https://stackoverflow.com/questions/17959663/)),
you can "farm out" tasks to the other cores using [**Child Process**](https://nodejs.org/api/child_process.html)(es)

@@ -89,3 +103,3 @@

Sadly this results in [***Zombie Processes***](http://stackoverflow.com/questions/27381163)
Sadly this results in [***Zombie Processes***](https://stackoverflow.com/questions/27381163)
which you would have to either *manually* kill or restart the machine/VM to clear.

@@ -99,3 +113,3 @@ Instead you need to *find* all the Process IDs for the child processes

## Dependencies [![Dependency Status](https://david-dm.org/dwyl/terminate.svg)](https://david-dm.org/dwyl/terminate) [![devDependency Status](https://david-dm.org/dwyl/terminate/dev-status.svg)](https://david-dm.org/dwyl/terminate#info=devDependencies) [![Retire Status](https://img.shields.io/badge/security-no%20known%20vulnerabilities-brightgreen.svg)](http://retire.insecurity.today/api/image?uri=https://raw.githubusercontent.com/dwyl/terminate/master/package.json)
## Dependencies [![Dependency Status](https://david-dm.org/dwyl/terminate.svg)](https://david-dm.org/dwyl/terminate) [![devDependency Status](https://david-dm.org/dwyl/terminate/dev-status.svg)](https://david-dm.org/dwyl/terminate#info=devDependencies) [![Retire Status](https://img.shields.io/badge/security-no%20known%20vulnerabilities-brightgreen.svg)](https://retire.insecurity.today/api/image?uri=https://raw.githubusercontent.com/dwyl/terminate/master/package.json)

@@ -143,9 +157,9 @@ While researching how to get a list of child processes given a

+ http://stackoverflow.com/questions/27381163/spawning-node-js-child-processes-results-in-zombie-processes-on-cloud-foundry-s
+ http://stackoverflow.com/questions/26694100/why-does-my-node-app-process-keep-getting-stopped-when-i-use-forever
+ http://stackoverflow.com/questions/18275809/kill-all-child-process-when-node-process-is-killed
+ http://stackoverflow.com/questions/26004519/why-doesnt-my-node-js-process-terminate-once-all-listeners-have-been-removed
+ http://stackoverflow.com/questions/14319724/nodejs-exec-command-failing-with-no-useful-error-message
+ http://stackoverflow.com/questions/9275654/how-many-child-processes-can-a-node-js-cluster-spawn-on-a-64bit-wintel-pc
+ http://stackoverflow.com/questions/17959663/why-is-node-js-single-threaded
+ [spawning node.js child processes results in zombie processes on cloud foundry](https://stackoverflow.com/questions/27381163)
+ [Why does my node app process keep getting stopped when I use forever?](https://stackoverflow.com/questions/26694100)
+ [kill all child_process when node process is killed](https://stackoverflow.com/questions/18275809)
+ [Why doesn't my Node.js process terminate once all listeners have been removed?](https://stackoverflow.com/questions/26004519)
+ [nodejs exec command failing with no useful error message](https://stackoverflow.com/questions/14319724)
+ [How many child processes can a node.js cluster spawn on a 64bit Wintel PC?](https://stackoverflow.com/questions/9275654)
+ [Why is Node.js single threaded?](https://stackoverflow.com/questions/17959663)

@@ -171,4 +185,4 @@

![xkcd terminate](http://i.imgur.com/KQ9v7ll.png)
![xkcd terminate](https://i.imgur.com/KQ9v7ll.png)
![xkcd time robot](http://imgs.xkcd.com/comics/time_robot.png)
![xkcd time robot](https://imgs.xkcd.com/comics/time_robot.png)
'use strict';
var psTree = require('ps-tree'); // see: http://git.io/jBHZ
var psTree = require('ps-tree'); // see: https://git.io/jBHZ
var handlePsTreeCallback = require('./handlePsTreeCallback');

@@ -5,0 +5,0 @@

var test = require('tape');
var chalk = require('chalk');
var red = chalk.red, green = chalk.green, cyan = chalk.cyan;
var psTree = require('ps-tree'); // see: http://git.io/jBHZ
var psTree = require('ps-tree'); // see: https://git.io/jBHZ
var exec = require('child_process').exec;

@@ -6,0 +6,0 @@

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