Skip to content

Commit

Permalink
Cache family
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofandel authored Oct 28, 2024
1 parent 7356374 commit f93eaef
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions lib/current-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@ function cpu () {
}

let family
if (os() === 'linux') {
const originalExclude = process.report.excludeNetwork
process.report.excludeNetwork = true
const report = process.report.getReport()
process.report.excludeNetwork = originalExclude
if (report.header?.glibcVersionRuntime) {
family = 'glibc'
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
family = 'musl'
}
}
function libc (osName) {
if (osName !== 'linux') {
return undefined
}

if (!family) {
const originalExclude = process.report.excludeNetwork
process.report.excludeNetwork = true
const report = process.report.getReport()
process.report.excludeNetwork = originalExclude
if (report.header?.glibcVersionRuntime) {
family = 'glibc'
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
family = 'musl'
}
}
return family
}

Expand Down

0 comments on commit f93eaef

Please sign in to comment.