Skip to content

Commit 51af910

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

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/current-env.js

Lines changed: 4 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,8 @@ function libc (osName) {
2824
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
2925
family = 'musl'
3026
}
27+
}
28+
function libc (osName) {
3129
return family
3230
}
3331

0 commit comments

Comments
 (0)