JSPM

ps-sync

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q31858F
  • License BSD-2-Clause

Syncronous Process query tool

Package Exports

  • ps-sync

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ps-sync) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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