Consider using pidtree package
See original GitHub issueCurrently this package recursively kill processes level by level spawning the ps
or pgrep
a lot of times.
I’ve built this package that maybe can help to improve performance. https://github.com/simonepri/pidtree
My benchmarks shows that is really fast (~5-10 ms per call regardless of how big the sub-tree is) but I don’t know if it would be adapt for the use of this package.
What’s the advantage of calling ps
or pgrep
multiple times instead of parsing the tree just calling ps
once? Memory efficiency? Or it was just simpler to implement?
See also: https://github.com/Unitech/pm2/pull/3554#issuecomment-374758938
cc: @soyuka
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
pidtree - npm
Start using pidtree in your project by running `npm i pidtree`. ... pidtree. TypeScript icon, indicating that this package has built-in type ...
Read more >Ever considered using windows-process-tree? · Issue #31 ... - GitHub
Just happened upon this and I figured it might be neat if this package wrapped/abstracted it. This is made by Microsoft, so it's...
Read more >pstree.remy - npm Package Health Analysis - Snyk
Snyk scans all the packages in your projects for vulnerabilities and ... An important project maintenance signal to consider for pstree.remy is that...
Read more >pstree - Go Packages
Package pstree provides an API to retrieve the process tree from procfs.
Read more >ps: How can i recursively get all child process for a given pid
On Gentoo Linux, pstree is in the package "psmisc," apparently located at ... pidtree() { for _pid in "$@"; do echo $_pid pidtree...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes kind of. Actually my belief is that
taskkill
should be faster for windows.I’ll work on this as soon as possible, right now I’m a bit busy.