Skip to content

Commit d059dbc

Browse files
authored
doc: add a note about os.cpus() returning an empty list
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
1 parent 4c9ec98 commit d059dbc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

doc/api/os.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ The properties included on each object include:
142142
`nice` values are POSIX-only. On Windows, the `nice` values of all processors
143143
are always 0.
144144

145+
On Linux and Android when `/proc` filesystem is not accessible, this function
146+
may return an empty list.
147+
145148
`os.cpus().length` should not be used to calculate the amount of parallelism
146149
available to an application. Use
147150
[`os.availableParallelism()`](#osavailableparallelism) for this purpose.

0 commit comments

Comments
 (0)