detect-libc
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -6,3 +6,3 @@ #!/usr/bin/env node | ||
const spawnSync = require('child_process').spawnSync; | ||
const family = require('../').family; | ||
const libc = require('../'); | ||
@@ -15,6 +15,6 @@ const spawnOptions = { | ||
if (family && family !== 'glibc') { | ||
spawnOptions.env.LIBC = process.env.LIBC || family; | ||
if (libc.isNonGlibcLinux) { | ||
spawnOptions.env.LIBC = process.env.LIBC || libc.family; | ||
} | ||
process.exit(spawnSync(process.argv[2], process.argv.slice(3), spawnOptions).status); |
@@ -6,2 +6,5 @@ 'use strict'; | ||
const GLIBC = 'glibc'; | ||
const MUSL = 'musl'; | ||
const spawnOptions = { | ||
@@ -19,3 +22,3 @@ encoding: 'utf8', | ||
if (glibc.status === 0) { | ||
family = 'glibc'; | ||
family = GLIBC; | ||
version = glibc.stdout.trim().split(' ')[1]; | ||
@@ -27,3 +30,3 @@ } else { | ||
if (ldd.stdout.indexOf('musl') !== -1) { | ||
family = 'musl'; | ||
family = MUSL; | ||
version = ldd.stdout.split(/[\r\n]+/)[1].trim().split(/\s/)[1]; | ||
@@ -35,5 +38,10 @@ } | ||
const isNonGlibcLinux = (family !== '' && family !== GLIBC); | ||
module.exports = { | ||
GLIBC: GLIBC, | ||
MUSL: MUSL, | ||
family: family, | ||
version: version | ||
version: version, | ||
isNonGlibcLinux: isNonGlibcLinux | ||
}; |
{ | ||
"name": "detect-libc", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Node.js module to detect the C standard library (libc) implementation family and version", | ||
@@ -5,0 +5,0 @@ "main": "lib/detect-libc.js", |
@@ -26,7 +26,10 @@ # detect-libc | ||
```js | ||
const { family, version } = require('detect-libc'); | ||
const { GLIBC, MUSL, family, version, isNonGlibcLinux } = require('detect-libc'); | ||
``` | ||
* `family` is a String representing the system's libc family. | ||
* `version` is a String representing the system's libc version. | ||
* `GLIBC` is a String containing the value "glibc" for comparison with `family`. | ||
* `MUSL` is a String containing the value "musl" for comparison with `family`. | ||
* `family` is a String representing the system libc family. | ||
* `version` is a String representing the system libc version number. | ||
* `isNonGlibcLinux` is a Boolean representing whether the system is a non-glibc Linux, e.g. Alpine. | ||
@@ -53,3 +56,3 @@ ### detect-libc command line tool | ||
"dependencies": { | ||
"detect-libc": "^0.0.7", | ||
"detect-libc": "^0.0.8", | ||
"prebuild-install": "^2.2.0" | ||
@@ -56,0 +59,0 @@ }, |
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
15720
49
77