pidusage
pidusage copied to clipboard
Allow PIDUSAGE_USE_PS to have string type of "true"
| Q | A |
|---|---|
| Branch? | main |
| Bug fix? | no |
| New feature? | no (well, maybe - I really small one) |
| Deprecations? | no |
| Tickets | no |
| License | MIT |
| Doc PR |
I have been using pm2 on DigitalOcean and wanted to set process.env.PIDUSAGE_USE_PS as per the discussion here https://github.com/Unitech/pm2/issues/5045. But because we are using Node and in Node environment variables are always strings, this comparison below fails for "true" === true or "1" === true etc.
https://github.com/soyuka/pidusage/blob/61f63bd9e8f576c4b7b673171dc7262bd3c26ae8/lib/stats.js#L50
The code below makes it work for "true".
Who can we tag for visibility here? A lot of people would benefit from this PR! See https://github.com/Unitech/pm2/issues/4360
Any chance this could make it in? using digital ocean "app container" and wasn't able to fix the PM2 error: Error caught while calling pidusage error. had to switch to something else.
I had to do a patch-package in pm2 via https://github.com/Unitech/pm2/issues/4360#issuecomment-1148869202 in order to make this work in digitalocean apps.
This PR would be massive.
am so sorry I didn't merge early, will get into the next patch!