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

Terminate a Node.js Process based on the Process ID

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

terminate

A reliable (tested) way to Terminate a Node.js Process (and all Child Processes) based on the Process ID

terminate-the-node-process-final

Build Status Code Climate Test Coverage npm version Node.js Version Dependency Status

Usage

Install from NPM

npm install terminate --save

In your script

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!
 }
})

tl;dr

Why?

In our 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 Terminateed before re-start.

Research

Background Reading

Useful StackOverflow Questions/Answers

Background / Motivation

While building the Faster module we decided to use Child Process(es) to run the application we are observing.
As a result, we need to be able to kill those processes in order to re-start the app.

Why not use an Existing Module?

We investigated using terminate: https://github.com/indexzero/terminate/ it was un-maintained and had no tests so we submitted an issue offering to update the module with tests.
Charlie replied welcoming an update so we submitted a Pull Request with 100% test coverage

Other potential modules:

Name

Terminate seemed like the best (of the available) name,
if you have a better suggestion, please share!



## This Project Reminded me of Two *xkcd* Comics:

xkcd terminate

xkcd time robot

Keywords

FAQs

Package last updated on 27 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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