process-exists
Check if a process is running
Last updated 7 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm
$ cnpm install process-exists 
SYNC missed versions from official npm registry.

process-exists Build Status

Check if a process is running

Install

$ npm install process-exists

Usage

const processExists = require('process-exists');

(async () => {
	console.log(await processExists(process.pid));
	//=> true

	const exists = await processExists.all([process.pid, 'foo']);

	console.log(exists.get(process.pid));
	//=> true

	console.log(exists.get('foo'));
	//=> false

	console.log(processExists.filterExists(exists));
	//=> [process.pid]
})();

API

processExists(input)

Returns a Promise<boolean>.

input

Type: number | string

Process ID or name to check.

processExists.all(input)

Returns a Promise<Map> with the process name/ID as key and the status as a boolean value.

input

Type: Array<number | string>

Process IDs or names to check.

processExists.filterExists(input)

Returns an Array<number | string> with the processes that exist.

input

Type: Array<number | string>

Process IDs or names to check.

Current Tags

  • 5.0.0                                ...           latest (4 years ago)

3 Versions

  • 5.0.0                                ...           4 years ago
  • 4.1.0                                ...           4 years ago
  • 3.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org