ps-sync

0.0.2 • Public • Published

ps-sync

Syncronous ps tool for node.js

This library is written to be executed syncronously. As such, it is not recommended to be used in for web servers where blocking processes would be a problem.

installation

npm install ps-sync

Usage

var ps = require('ps-sync')

var psRecs = ps.query({pid: <pid(s)>})

where: <pid(s)> is a single pid or an array of multiple pids

psRecs will contain an object with pid as the key and an object containing process info for the given pid.

If pid is not found you will get back ps.PID_NOT_FOUND which looks like '(pid_not_found)'. You can easily test for pid like: if(psRecs[pid]==ps.PID_NOT_FOUND){ // handle accordingly } else { // pid found, you should have an object with data. }

Data returned if pid is found:

Field Description
pid Process Id
ppid Parent Process Id
command Executable name
commandPath Full path to executable
args Command arguments

Readme

Keywords

Package Sidebar

Install

npm i ps-sync

Weekly Downloads

0

Version

0.0.2

License

BSD-2-Clause

Last publish

Collaborators

  • javascriptdude