-
-
Notifications
You must be signed in to change notification settings - Fork 337
Description
Describe the bug
Despite that all calls to the library return promises, the promises themselves are blocking, defeating much of the purpose of having them in the first place.
The reason they are blocking is because the implementation of systeminformation uses calls like execSync(), instead of just exec() (and then awaiting the result).
To Reproduce
Use-case: Fetching WiFi info running in the electron main process.
Steps to reproduce the behavior:
- Issue
await si.wifiNetworks(), assuming it will take long time (several seconds). - While waiting for the info, the thread awaiting the network info is blocked from doing other work (even though promises are used).
Expected behavior
I expect that awaiting the result shouldn't be really blocking the thread, just making it available for other tasks to run while awaiting the result.
Environment (please complete the following information)
- systeminformation package version: 5.21.18
- OS: Linux
Additional information
To always reproduce the problem, simply modify an existing command to something like execSync('sleep 10;' + originalCmd).
Workaround
Put the offending systeminformation call in a worker thread, which can be properly awaited without blocking anything.