https://github.com/jdx/is-process-active
Node cross-platform support for detecting if a process pid is active
https://github.com/jdx/is-process-active
node pid process
Last synced: 3 months ago
JSON representation
Node cross-platform support for detecting if a process pid is active
- Host: GitHub
- URL: https://github.com/jdx/is-process-active
- Owner: jdx
- Created: 2018-01-04T16:16:16.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-01-08T23:00:05.000Z (6 months ago)
- Last Synced: 2025-04-06T05:01:54.451Z (3 months ago)
- Topics: node, pid, process
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/is-process-active
- Size: 116 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
is-process-active
=================[](https://greenkeeper.io/)
[](https://circleci.com/gh/jdxcode/is-process-active/tree/master)
[](https://ci.appveyor.com/project/Heroku/is-process-active/branch/master)
[](https://codecov.io/gh/jdxcode/is-process-active)
[](https://npmjs.org/package/is-process-active)
[](https://npmjs.org/package/is-process-active)
[](https://github.com/jdxcode/is-process-active/blob/master/package.json)
[](https://david-dm.org/jdxcode/is-process-active)
[](https://github.com/prettier/prettier)Cross-platform support for detecting if a process pid is active. Uses `process.kill(pid, 0)` on unix and `tasklist.exe` on Windows.
This method is extremely fast on Unix and the fastest I'm aware of for Windows.
**Usage**:
```js
const pid = require('is-process-active')
if (pid.activeSync(myPid)) {
// do something if process is active
}// or...
if (await pid.active(myPid)) {
// do something if process is active
}
```Note that on Unix it is [always synchronous](https://github.com/jdxcode/is-process-active/blob/master/src/unix.ts#L5). So if you never have to support Windows there is no reason to use the async version.