Skip to content

Commit

Permalink
doc: add a note about os.cpus() returning an empty list
Browse files Browse the repository at this point in the history
It is not obvious that in some cases cpus() returns an empty list and this has caused a bug before: isaacs/promise-call-limit#11
  • Loading branch information
codedokode authored Apr 1, 2023
1 parent 4c9ec98 commit d059dbc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/api/os.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ The properties included on each object include:
`nice` values are POSIX-only. On Windows, the `nice` values of all processors
are always 0.

On Linux and Android when `/proc` filesystem is not accessible, this function
may return an empty list.

`os.cpus().length` should not be used to calculate the amount of parallelism
available to an application. Use
[`os.availableParallelism()`](#osavailableparallelism) for this purpose.
Expand Down

0 comments on commit d059dbc

Please sign in to comment.