detect-libc
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -31,2 +31,9 @@ 'use strict'; | ||
function safeReaddirSync (path) { | ||
try { | ||
return readdirSync(path); | ||
} catch (e) {} | ||
return []; | ||
} | ||
var family = ''; | ||
@@ -56,19 +63,19 @@ var version = ''; | ||
// Try filesystem (family only) | ||
try { | ||
var lib = readdirSync('/lib'); | ||
var usrSbin = readdirSync('/usr/sbin'); | ||
if (lib.some(contains('-linux-gnu'))) { | ||
var lib = safeReaddirSync('/lib'); | ||
if (lib.some(contains('-linux-gnu'))) { | ||
family = GLIBC; | ||
method = 'filesystem'; | ||
} else if (lib.some(contains('libc.musl-'))) { | ||
family = MUSL; | ||
method = 'filesystem'; | ||
} else if (lib.some(contains('ld-musl-'))) { | ||
family = MUSL; | ||
method = 'filesystem'; | ||
} else { | ||
var usrSbin = safeReaddirSync('/usr/sbin'); | ||
if (usrSbin.some(contains('glibc'))) { | ||
family = GLIBC; | ||
method = 'filesystem'; | ||
} else if (lib.some(contains('libc.musl-'))) { | ||
family = MUSL; | ||
method = 'filesystem'; | ||
} else if (lib.some(contains('ld-musl-'))) { | ||
family = MUSL; | ||
method = 'filesystem'; | ||
} else if (usrSbin.some(contains('glibc'))) { | ||
family = GLIBC; | ||
method = 'filesystem'; | ||
} | ||
} catch (e) {} | ||
} | ||
} | ||
@@ -75,0 +82,0 @@ } |
{ | ||
"name": "detect-libc", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Node.js module to detect the C standard library (libc) implementation family and version", | ||
@@ -5,0 +5,0 @@ "main": "lib/detect-libc.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17192
94