soyuka / pidusage

Cross-platform process cpu % and memory usage of a PID
MIT License
512 stars 55 forks source link

There is no interval.unref in Electron #109

Closed lierdakil closed 4 years ago

lierdakil commented 4 years ago

https://github.com/soyuka/pidusage/blob/b52a86c219552fb66613e524b9900646f50cdc0a/lib/history.js#L42

This line breaks compatibility with Electron apps, which uses Chromium-provided setTimeout/setInterval instead of Node's implementations.

Perhaps a reasonable band-aid is to check if unref function exists before invoking it?

simonepri commented 4 years ago

@lierdakil Would you mind submitting a PR?

I think checking before invocation is fine.