MCPcopy Index your code
hub / github.com/nodejs/node / isPi

Function isPi

test/common/index.js:187–199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

185const isRiscv64 = process.arch === 'riscv64';
186const isDebug = process.features.debug;
187function isPi() {
188 try {
189 // Normal Raspberry Pi detection is to find the `Raspberry Pi` string in
190 // the contents of `/sys/firmware/devicetree/base/model` but that doesn't
191 // work inside a container. Match the chipset model number instead.
192 const cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' });
193 const ok = /^Hardware\s*:\s*(.*)$/im.exec(cpuinfo)?.[1] === 'BCM2835';
194 /^/.test(''); // Clear RegExp.$_, some tests expect it to be empty.
195 return ok;
196 } catch {
197 return false;
198 }
199}
200
201// When using high concurrency or in the CI we need much more time for each connection attempt.
202// Default 500ms becomes 2500ms for tests.

Callers 1

platformTimeoutFunction · 0.85

Calls 3

readFileSyncMethod · 0.45
execMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…