From d2bba650c944f719f5e0e1f41dbedf215d5f4eef Mon Sep 17 00:00:00 2001 From: Adrien Foulon <6115458+Tofandel@users.noreply.github.com> Date: Mon, 28 Oct 2024 17:24:52 +0100 Subject: [PATCH] Fix checkPlatform takes an insane amount of time to complete when used in a loop --- lib/current-env.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/current-env.js b/lib/current-env.js index 9babde1..92134c3 100644 --- a/lib/current-env.js +++ b/lib/current-env.js @@ -13,12 +13,8 @@ function cpu () { return process.arch } -function libc (osName) { - // this is to make it faster on non linux machines - if (osName !== 'linux') { - return undefined - } - let family +let family +if (os() === 'linux') { const originalExclude = process.report.excludeNetwork process.report.excludeNetwork = true const report = process.report.getReport() @@ -28,6 +24,11 @@ function libc (osName) { } else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) { family = 'musl' } +} +function libc (osName) { + if (osName !== 'linux') { + return undefined + } return family }