os: add fallback for undefined CPUs
Currently, for an unsupported OS, a call to os.cpus()
throws an error within os.cpus()
itself where it tries to get the length of undefined. This PR fixes the issue by adding fallback for undefined CPUs.
Fixes: https://github.com/nodejs/node/issues/25483
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines