{"_id":"ps-tree","_rev":"207667","name":"ps-tree","description":"Get all children of a pid","dist-tags":{"latest":"1.2.0"},"maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"time":{"modified":"2021-06-03T13:46:03.000Z","created":"2011-10-05T06:43:34.904Z","1.2.0":"2018-11-26T19:39:24.956Z","1.1.1":"2018-11-26T18:15:46.843Z","1.1.0":"2016-06-01T05:52:23.874Z","1.0.1":"2015-09-18T09:13:33.505Z","1.0.0":"2015-04-11T07:38:26.763Z","0.0.3":"2012-11-29T11:10:00.999Z","0.0.2":"2011-11-15T00:01:28.120Z","0.0.1":"2011-10-29T01:29:18.842Z","0.0.0":"2011-10-05T06:43:34.904Z"},"users":{"dypsilon":true,"quilesbaker":true,"uniquevn":true,"dimd13":true,"reergymerej":true,"msolters":true,"itskdk":true,"scottfreecode":true,"icerainnuaa":true,"dankle":true},"author":{"name":"Charlie Robbins","email":"charlie.robbins@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/indexzero/ps-tree.git"},"versions":{"1.2.0":{"name":"ps-tree","version":"1.2.0","description":"Get all children of a pid","license":"MIT","homepage":"http://github.com/indexzero/ps-tree#readme","repository":{"type":"git","url":"git+https://github.com/indexzero/ps-tree.git"},"bugs":{"url":"https://github.com/indexzero/ps-tree/issues","email":"charlie.robbins@gmail.com"},"author":{"name":"Charlie Robbins","email":"charlie.robbins@gmail.com"},"contributors":[{"name":"Zhuohuan LI","email":"zixia@zixia.net","url":"https://github.com/zixia"},{"name":"Simone Primarosa","email":"simonepri@outlook.com","url":"https://github.com/simonepri"}],"keyboards":["ps-tree","ps","tree","ppid","pid"],"main":"index.js","bin":{"ps-tree":"./bin/ps-tree.js"},"engines":{"node":">= 0.10"},"scripts":{"test":"istanbul cover node_modules/tape/bin/tape test/test.js","coverage":"cross-env CODECLIMATE_REPO_TOKEN=84436b4f13c70ace9c62e7f04928bf23c234eb212c0232d39d7fb1535beb2da5 node_modules/.bin/codeclimate-test-reporter < coverage/lcov.info"},"dependencies":{"event-stream":"=3.3.4"},"devDependencies":{"codeclimate-test-reporter":"^0.5.0","cross-env":"^2.0.1","istanbul":"^0.4.5","tape":"^4.9.0","tree-kill":"^1.1.0"},"gitHead":"696046801b2145df4c0c18bfeafe38dcb9b0a695","_id":"ps-tree@1.2.0","_npmVersion":"6.2.0","_nodeVersion":"8.10.0","_npmUser":{"name":"indexzero","email":"charlie.robbins@gmail.com"},"maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"dist":{"shasum":"5e7425b89508736cdd4f2224d028f7bb3f722ebd","size":4032,"noattachment":false,"key":"/ps-tree/-/ps-tree-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ps-tree/download/ps-tree-1.2.0.tgz"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ps-tree_1.2.0_1543261164717_0.8205016894578647"},"_hasShrinkwrap":false,"publish_time":1543261164956,"_cnpm_publish_time":1543261164956},"1.1.1":{"name":"ps-tree","version":"1.1.1","description":"Get all children of a pid","license":"MIT","homepage":"http://github.com/indexzero/ps-tree#readme","repository":{"type":"git","url":"git+https://github.com/indexzero/ps-tree.git"},"bugs":{"url":"https://github.com/indexzero/ps-tree/issues","email":"charlie.robbins@gmail.com"},"author":{"name":"Charlie Robbins","email":"charlie.robbins@gmail.com"},"contributors":[{"name":"Zhuohuan LI","email":"zixia@zixia.net","url":"https://github.com/zixia"},{"name":"Simone Primarosa","email":"simonepri@outlook.com","url":"https://github.com/simonepri"}],"keyboards":["ps-tree","ps","tree","ppid","pid"],"main":"index.js","bin":{"ps-tree":"./bin/ps-tree.js"},"engines":{"node":">= 0.10"},"scripts":{"_comment":"https://github.com/gotwarlost/istanbul#usage-on-windows","test":"istanbul cover node_modules/tape/bin/tape test/test.js test/direct.js","coverage":"npm test && istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100","codeclimate":"cross-env CODECLIMATE_REPO_TOKEN=84436b4f13c70ace9c62e7f04928bf23c234eb212c0232d39d7fb1535beb2da5 codeclimate < coverage/lcov.info"},"dependencies":{"event-stream":"=3.3.4"},"devDependencies":{"chalk":"^1.0.0","codeclimate-test-reporter":"0.0.4","cross-env":"^1.0.8","istanbul":"^0.3.20","pre-commit":"0.0.9","precommit":"^1.1.5","tape":"^3.0.3","tree-kill":"^1.1.0"},"pre-commit":["coverage","codeclimate"],"gitHead":"1268bc5e7e26c81dc7c61b8c7558d90fe4fbe46f","_id":"ps-tree@1.1.1","_npmVersion":"6.2.0","_nodeVersion":"8.10.0","_npmUser":{"name":"indexzero","email":"charlie.robbins@gmail.com"},"maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"dist":{"shasum":"5f1ba35455b8c25eeb718d04c37de1555d96d3db","size":4084,"noattachment":false,"key":"/ps-tree/-/ps-tree-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ps-tree/download/ps-tree-1.1.1.tgz"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ps-tree_1.1.1_1543256146659_0.8395652161522882"},"_hasShrinkwrap":false,"publish_time":1543256146843,"_cnpm_publish_time":1543256146843},"1.1.0":{"name":"ps-tree","version":"1.1.0","description":"Get all children of a pid","homepage":"http://github.com/indexzero/ps-tree","repository":{"type":"git","url":"git+https://github.com/indexzero/ps-tree.git"},"dependencies":{"event-stream":"~3.3.0"},"license":"MIT","author":{"name":"Charlie Robbins","email":"charlie.robbins@gmail.com"},"contributors":[{"name":"Zhuohuan LI","email":"zixia@zixia.net","url":"https://github.com/zixia"}],"directories":{"test":"test"},"scripts":{"_comment":"https://github.com/gotwarlost/istanbul#usage-on-windows","test":"istanbul cover node_modules/tape/bin/tape test/test.js test/direct.js","coverage":"npm test && istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100","codeclimate":"cross-env CODECLIMATE_REPO_TOKEN=84436b4f13c70ace9c62e7f04928bf23c234eb212c0232d39d7fb1535beb2da5 codeclimate < coverage/lcov.info"},"devDependencies":{"chalk":"^1.0.0","codeclimate-test-reporter":"0.0.4","cross-env":"^1.0.8","istanbul":"^0.3.20","pre-commit":"0.0.9","precommit":"^1.1.5","tape":"^3.0.3","tree-kill":"^1.1.0"},"pre-commit":["coverage","codeclimate"],"engines":{"node":">= 0.10"},"gitHead":"2d7ccd06b3c3cf58b386617e5405ab8c318e37e5","bugs":{"url":"https://github.com/indexzero/ps-tree/issues"},"_id":"ps-tree@1.1.0","_shasum":"b421b24140d6203f1ed3c76996b4427b08e8c014","_from":".","_npmVersion":"3.8.9","_nodeVersion":"4.4.3","_npmUser":{"name":"indexzero","email":"charlie.robbins@gmail.com"},"maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"dist":{"shasum":"b421b24140d6203f1ed3c76996b4427b08e8c014","size":7490,"noattachment":false,"key":"/ps-tree/-/ps-tree-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ps-tree/download/ps-tree-1.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/ps-tree-1.1.0.tgz_1464760342785_0.9020391085650772"},"publish_time":1464760343874,"_cnpm_publish_time":1464760343874,"_hasShrinkwrap":false},"1.0.1":{"name":"ps-tree","version":"1.0.1","description":"Get all children of a pid","homepage":"http://github.com/indexzero/ps-tree","repository":{"type":"git","url":"git+https://github.com/indexzero/ps-tree.git"},"dependencies":{"event-stream":"~3.3.0"},"license":"MIT","author":{"name":"Charlie Robbins","email":"charlie.robbins@gmail.com"},"directories":{"test":"test"},"scripts":{"test":"istanbul cover ./node_modules/.bin/tape ./test/test.js ./test/direct.js","coverage":"npm test && istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100","codeclimate":"CODECLIMATE_REPO_TOKEN=84436b4f13c70ace9c62e7f04928bf23c234eb212c0232d39d7fb1535beb2da5 ./node_modules/codeclimate-test-reporter/bin/codeclimate.js < ./coverage/lcov.info"},"devDependencies":{"chalk":"^1.0.0","codeclimate-test-reporter":"0.0.4","istanbul":"^0.3.20","pre-commit":"0.0.9","precommit":"^1.1.5","tape":"^3.0.3"},"pre-commit":["coverage","codeclimate"],"engines":{"node":">=0.10"},"gitHead":"426357c2ba02ff9bf2756b87fc1fd0c7842d7137","bugs":{"url":"https://github.com/indexzero/ps-tree/issues"},"_id":"ps-tree@1.0.1","_shasum":"c64063b4ce8d72f7f874975f3ecc5f3597ac8e4b","_from":".","_npmVersion":"2.14.2","_nodeVersion":"0.12.7","_npmUser":{"name":"indexzero","email":"charlie.robbins@gmail.com"},"maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"dist":{"shasum":"c64063b4ce8d72f7f874975f3ecc5f3597ac8e4b","size":5714,"noattachment":false,"key":"/ps-tree/-/ps-tree-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ps-tree/download/ps-tree-1.0.1.tgz"},"publish_time":1442567613505,"_cnpm_publish_time":1442567613505,"_hasShrinkwrap":false},"1.0.0":{"name":"ps-tree","version":"1.0.0","description":"Get all children of a pid","homepage":"http://github.com/indexzero/ps-tree","repository":{"type":"git","url":"https://github.com/indexzero/ps-tree.git"},"dependencies":{"event-stream":"~3.3.0"},"author":{"name":"Charlie Robbins"},"directories":{"test":"test"},"scripts":{"test":"istanbul cover ./node_modules/tape/bin/tape ./test/*.js","coverage":"istanbul cover ./node_modules/tape/bin/tape ./test/*.js && ./node_modules/.bin/istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100","codeclimate":"CODECLIMATE_REPO_TOKEN=84436b4f13c70ace9c62e7f04928bf23c234eb212c0232d39d7fb1535beb2da5 ./node_modules/codeclimate-test-reporter/bin/codeclimate.js < ./coverage/lcov.info"},"devDependencies":{"chalk":"^1.0.0","codeclimate-test-reporter":"0.0.4","istanbul":"^0.3.4","pre-commit":"0.0.9","tape":"^3.0.3"},"pre-commit":["coverage","codeclimate"],"engines":{"node":">=0.10"},"gitHead":"93d8ec6ee8e5d20b19549db6f63426878d6483b2","bugs":{"url":"https://github.com/indexzero/ps-tree/issues"},"_id":"ps-tree@1.0.0","_shasum":"0eb64708a60b54e3331636e4a03e7b62c8a4beec","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.36","_npmUser":{"name":"indexzero","email":"charlie.robbins@gmail.com"},"maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"dist":{"shasum":"0eb64708a60b54e3331636e4a03e7b62c8a4beec","size":5517,"noattachment":false,"key":"/ps-tree/-/ps-tree-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ps-tree/download/ps-tree-1.0.0.tgz"},"publish_time":1428737906763,"_cnpm_publish_time":1428737906763,"_hasShrinkwrap":false},"0.0.3":{"name":"ps-tree","version":"0.0.3","description":"get all children of a pid","homepage":"http://github.com/indexzero/ps-tree","repository":{"type":"git","url":"https://github.com/indexzero/ps-tree.git"},"dependencies":{"event-stream":"~0.5"},"author":{"name":"Charlie Robbins"},"readmeFilename":"readme.markdown","_id":"ps-tree@0.0.3","dist":{"shasum":"dbf8d752a7fe22fa7d58635689499610e9276ddc","size":1672,"noattachment":false,"key":"/ps-tree/-/ps-tree-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/ps-tree/download/ps-tree-0.0.3.tgz"},"_npmVersion":"1.1.66","_npmUser":{"name":"indexzero","email":"charlie.robbins@gmail.com"},"maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"directories":{},"publish_time":1354187400999,"_hasShrinkwrap":false,"_cnpm_publish_time":1354187400999},"0.0.2":{"name":"ps-tree","version":"0.0.2","description":"get all children of a pid","homepage":"http://github.com/dominictarr/ps-tree","repository":{"type":"git","url":"git://github.com/dominictarr/ps-tree.git"},"dependencies":{"parse-table":"0"},"devDependencies":{},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"_id":"ps-tree@0.0.2","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.103","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"e33b587afec35f354d4bef0c404c573e97d21b01","size":2196,"noattachment":false,"key":"/ps-tree/-/ps-tree-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/ps-tree/download/ps-tree-0.0.2.tgz"},"maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"directories":{},"publish_time":1321315288120,"_hasShrinkwrap":false,"_cnpm_publish_time":1321315288120},"0.0.1":{"name":"ps-tree","version":"0.0.1","description":"get all children of a pid","homepage":"http://github.com/dominictarr/ps-tree","repository":{"type":"git","url":"git://github.com/dominictarr/ps-tree.git"},"dependencies":{"parse-table":"0"},"devDependencies":{},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"_id":"ps-tree@0.0.1","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.101","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"2374496294e74e99107a3b2ae8ce4a352a928e1f","size":2196,"noattachment":false,"key":"/ps-tree/-/ps-tree-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ps-tree/download/ps-tree-0.0.1.tgz"},"maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"directories":{},"publish_time":1319851758842,"_hasShrinkwrap":false,"_cnpm_publish_time":1319851758842},"0.0.0":{"name":"ps-tree","version":"0.0.0","description":"get all children of a pid","homepage":"http://github.com/dominictarr/ps-tree","repository":{"type":"git","url":"git://github.com/dominictarr/ps-tree.git"},"dependencies":{"event-stream":"~0.5"},"devDependencies":{},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"_npmJsonOpts":{"file":"/home/dominic/.npm/ps-tree/0.0.0/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"ps-tree@0.0.0","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.27","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"2daec498b221c074fc9e9247de8c21a21209cf4c","size":1703,"noattachment":false,"key":"/ps-tree/-/ps-tree-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ps-tree/download/ps-tree-0.0.0.tgz"},"maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"directories":{},"publish_time":1317797014904,"_hasShrinkwrap":false,"_cnpm_publish_time":1317797014904}},"readme":"# ps-tree\n\n[![Build Status](https://travis-ci.org/indexzero/ps-tree.svg)](https://travis-ci.org/indexzero/ps-tree)\n[![Code Climate](https://codeclimate.com/github/indexzero/ps-tree/badges/gpa.svg)](https://codeclimate.com/github/indexzero/ps-tree)\n[![Test Coverage](https://codeclimate.com/github/indexzero/ps-tree/badges/coverage.svg)](https://codeclimate.com/github/indexzero/ps-tree)\n[![npm Version](https://img.shields.io/npm/v/ps-tree.svg)](https://www.npmjs.com/package/ps-tree)\n[![Node.js Version](https://img.shields.io/node/v/ps-tree.svg?style=flat)](http://nodejs.org/download/)\n[![Dependency Status](https://david-dm.org/indexzero/ps-tree.svg)](https://david-dm.org/indexzero/ps-tree)\n\nSometimes you cannot kill child processes like you would expect, this a feature of UNIX.\n\n>in UNIX, a process may terminate by using the exit call, and it's parent process may wait for that event by using the wait system call. the wait system call returns the process identifier of a terminated child, so that the parent tell which of the possibly many children has terminated. If the parent terminates, however, all it's children have assigned as their new parent the init process. Thus, the children still have a parent to collect their status and execution statistics.\n> (from \"operating system concepts\")\n\nSolution: use `ps-tree` to get all processes that a `child_process` may have started, so that they may all be terminated.\n\n``` js\nvar cp = require('child_process'),\n    psTree = require('ps-tree');\n\nvar child = cp.exec(\"node -e 'while (true);'\", function () {...});\n\n// This will not actually kill the child it will kill the `sh` process.\nchild.kill();\n```\n\nwtf? it's because exec actually works like this:\n\n``` js\nfunction exec (cmd, cb) {\n  spawn('sh', ['-c', cmd]);\n  ...\n}\n```\n\n`sh` starts parses the command string and starts processes, and waits for them to terminate, but `exec` returns a process object with the pid of the `sh` process.\nHowever, since it is in `wait` mode killing it does not kill the children.\n\nUse `ps-tree` like this:\n\n``` js\nvar cp = require('child_process'),\n    psTree = require('ps-tree');\n\nvar child = cp.exec(\"node -e 'while (true);'\", function () { /*...*/ });\n\npsTree(child.pid, function (err, children) {\n  cp.spawn('kill', ['-9'].concat(children.map(function (p) { return p.PID })));\n});\n```\n\nIf you prefer to run **psTree** from the command line, use: `node ./bin/ps-tree.js`\n\n## Cross Platform support\n\n\nThe `ps-tree` module behaves differently on *nix vs. Windows by spawning different programs and parsing their output. This is based on `process.platform` and not on checking to see if a `ps` compatible program exists on the system.\n\n#### *nix\n\n1. \" <defunct> \" need to be striped\n```bash\n$ ps -A -o comm,ppid,pid,stat\nCOMMAND          PPID   PID STAT\nbbsd             2899 16958 Ss\nwatch <defunct>  1914 16964 Z\nps              20688 16965 R+\n```\n\n### Windows\n1. `wmic PROCESS WHERE ParentProcessId=4604 GET Name,ParentProcessId,ProcessId,Status)`\n2. The order of head columns is fixed\n```shell\n> wmic PROCESS GET Name,ProcessId,ParentProcessId,Status\nName                          ParentProcessId  ProcessId   Status\nSystem Idle Process           0                0\nSystem                        0                4\nsmss.exe                      4                228\n```\n\n### LICENSE: MIT\n","_attachments":{},"homepage":"http://github.com/indexzero/ps-tree#readme","bugs":{"url":"https://github.com/indexzero/ps-tree/issues","email":"charlie.robbins@gmail.com"},"license":"MIT"}