Re: git: 981564583497 - main - net/cjdns: fix build on powerpc64*
Date: Wed, 27 Oct 2021 14:23:40 UTC
Not really: > os.cpus() [] > Math.floor((os.cpus() == [] ? 1 : cpus.length) * 1.25) Uncaught ReferenceError: cpus is not defined > Math.floor((os.cpus() == 0 ? 1 : cpus.length) * 1.25) 1 On 21-10-27 06:42:33, Alexey Dokuchaev wrote: > On Tue, Oct 26, 2021 at 06:48:52PM +0000, Piotr Kubaj wrote: > > commit 9815645834977fe2ada5052d3c81881b7624bed7 > > > > net/cjdns: fix build on powerpc64* > > > > On powerpc64 and powerpc64le systems, os.cpus(), gets defined to []: > > > cpus = os.cpus() > > [] > > > > It has type object: > > > typeof cpus > > 'object' > > > > This causes jobs to be 0: > > > Math.floor((typeof cpus === 'undefined' ? 1 : cpus.length) * 1.25); > > 0 > > > > Change it so that instead of comparing type to undefined, we compare to 0: > > > Math.floor((os.cpus() == 0 ? 1 : cpus.length) * 1.25); > > Wouldn't os.cpus() == [] be more correct^Wreadable? > > On a related note, JavaScript is horrible language, don't write in it. > Pro tip: if some $lang has === operator, it's highly likely that it is > just as bad. > > ./danfe