Skip to content

davidcoleman007/ps4js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ps4js

This module allows you to list and kill process on OSX and Windows.

We use ps and tasklist to list processes and kill and taskkill to kill a process.

We also include the ability to send either a force kill (sigkill (9) or sigterm (15)) to a process, depending on your needs.

Install

$ npm install ps4js

Usage

List processes

var ps = require('ps4js');

ps.list(function(err, results) {
  if (err)
    throw new Error( err );

  console.log(results); // [{pid: 2352, command: 'command'}, {...}]
});

Kill process by PID

var ps = require('ps4js');

ps.kill(12345, function(err, stdout) {
  if (err)
    throw new Error(err);

  console.log(stdout); // stdout for kill or taskkill command if any
});

Tests

npm test

Note

If the full command line is required on windows wmic.exe would be the way to go but it's not available on Windows XP Home Edition.

Licence

(MIT)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published