question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider using pidtree package

See original GitHub issue

Currently 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:open
  • Created 6 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
simonepricommented, Mar 21, 2018

Hah I just saw that https://github.com/Unitech/pm2/pull/3554/files basically IS such a PR

Yes kind of. Actually my belief is that taskkill should be faster for windows.

0reactions
simonepricommented, Mar 11, 2019

I’ll work on this as soon as possible, right now I’m a bit busy.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found