Skip to content

Commit f93eaef

Browse files
authored
Cache family
1 parent 7356374 commit f93eaef

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

lib/current-env.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,22 @@ function cpu () {
1414
}
1515

1616
let family
17-
if (os() === 'linux') {
18-
const originalExclude = process.report.excludeNetwork
19-
process.report.excludeNetwork = true
20-
const report = process.report.getReport()
21-
process.report.excludeNetwork = originalExclude
22-
if (report.header?.glibcVersionRuntime) {
23-
family = 'glibc'
24-
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
25-
family = 'musl'
26-
}
27-
}
2817
function libc (osName) {
2918
if (osName !== 'linux') {
3019
return undefined
3120
}
21+
22+
if (!family) {
23+
const originalExclude = process.report.excludeNetwork
24+
process.report.excludeNetwork = true
25+
const report = process.report.getReport()
26+
process.report.excludeNetwork = originalExclude
27+
if (report.header?.glibcVersionRuntime) {
28+
family = 'glibc'
29+
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
30+
family = 'musl'
31+
}
32+
}
3233
return family
3334
}
3435

0 commit comments

Comments
 (0)