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

process-exists

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

process-exists - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

12

index.js
'use strict';
const psList = require('ps-list');
module.exports = proc => {
let fn = x => x.pid === proc;
const fn = (proc, x) => {
if (typeof proc === 'string') {
fn = x => x.name === proc;
return x.name === proc;
}
return psList().then(list => list.some(x => fn(x)));
return x.pid === proc;
};
module.exports = proc => psList().then(list => list.some(x => fn(proc, x)));
module.exports.all = procs => psList().then(list => new Map(procs.map(x => [x, list.some(y => fn(x, y))])));
module.exports.filterExists = procs => psList().then(list => procs.filter(x => list.some(y => fn(x, y))));
{
"name": "process-exists",
"version": "3.0.0",
"version": "3.1.0",
"description": "Check if a process is running",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -22,2 +22,11 @@ # process-exists [![Build Status](https://travis-ci.org/sindresorhus/process-exists.svg?branch=master)](https://travis-ci.org/sindresorhus/process-exists)

});
processExists.all([process.pid, 'foo']).then(exists => {
console.log(exists.get(process.pid));
//=> true
console.log(exists.get('foo'));
//=> false
console.log(processExists.filterExists(exists));
//=> [process.pid]
});
```

@@ -38,5 +47,25 @@

### 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.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
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