Skip to content

Commit d2bba65

Browse files
committed
Fix checkPlatform takes an insane amount of time to complete when used in a loop
1 parent 4751cb4 commit d2bba65

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/current-env.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@ function cpu () {
1313
return process.arch
1414
}
1515

16-
function libc (osName) {
17-
// this is to make it faster on non linux machines
18-
if (osName !== 'linux') {
19-
return undefined
20-
}
21-
let family
16+
let family
17+
if (os() === 'linux') {
2218
const originalExclude = process.report.excludeNetwork
2319
process.report.excludeNetwork = true
2420
const report = process.report.getReport()
@@ -28,6 +24,11 @@ function libc (osName) {
2824
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
2925
family = 'musl'
3026
}
27+
}
28+
function libc (osName) {
29+
if (osName !== 'linux') {
30+
return undefined
31+
}
3132
return family
3233
}
3334

0 commit comments

Comments
 (0)