detect-libc
Advanced tools
Comparing version 0.2.0 to 1.0.0
@@ -5,6 +5,6 @@ #!/usr/bin/env node | ||
const spawnSync = require('child_process').spawnSync; | ||
const libc = require('../'); | ||
var spawnSync = require('child_process').spawnSync; | ||
var libc = require('../'); | ||
const spawnOptions = { | ||
var spawnOptions = { | ||
env: process.env, | ||
@@ -11,0 +11,0 @@ shell: true, |
'use strict'; | ||
const platform = require('os').platform(); | ||
const spawnSync = require('child_process').spawnSync; | ||
const readdirSync = require('fs').readdirSync; | ||
var platform = require('os').platform(); | ||
var spawnSync = require('child_process').spawnSync; | ||
var readdirSync = require('fs').readdirSync; | ||
const GLIBC = 'glibc'; | ||
const MUSL = 'musl'; | ||
var GLIBC = 'glibc'; | ||
var MUSL = 'musl'; | ||
const spawnOptions = { | ||
var spawnOptions = { | ||
encoding: 'utf8', | ||
@@ -21,8 +21,8 @@ env: process.env | ||
let family = ''; | ||
let version = ''; | ||
var family = ''; | ||
var version = ''; | ||
if (platform === 'linux') { | ||
if (spawnSync && platform === 'linux') { | ||
// Try getconf | ||
const glibc = spawnSync('getconf', ['GNU_LIBC_VERSION'], spawnOptions); | ||
var glibc = spawnSync('getconf', ['GNU_LIBC_VERSION'], spawnOptions); | ||
if (glibc.status === 0) { | ||
@@ -33,3 +33,3 @@ family = GLIBC; | ||
// Try ldd | ||
const ldd = spawnSync('ldd', ['--version'], spawnOptions); | ||
var ldd = spawnSync('ldd', ['--version'], spawnOptions); | ||
if (ldd.status === 0 && ldd.stdout.indexOf('musl') !== -1) { | ||
@@ -41,3 +41,3 @@ family = MUSL; | ||
try { | ||
const lib = readdirSync('/lib'); | ||
var lib = readdirSync('/lib'); | ||
if (lib.some(contains('-linux-gnu'))) { | ||
@@ -55,3 +55,3 @@ family = GLIBC; | ||
const isNonGlibcLinux = (family !== '' && family !== GLIBC); | ||
var isNonGlibcLinux = (family !== '' && family !== GLIBC); | ||
@@ -58,0 +58,0 @@ module.exports = { |
{ | ||
"name": "detect-libc", | ||
"version": "0.2.0", | ||
"version": "1.0.0", | ||
"description": "Node.js module to detect the C standard library (libc) implementation family and version", | ||
@@ -24,4 +24,4 @@ "main": "lib/detect-libc.js", | ||
"devDependencies": { | ||
"ava": "^0.20.0", | ||
"nyc": "^11.0.3", | ||
"ava": "^0.23.0", | ||
"nyc": "^11.2.1", | ||
"proxyquire": "^1.8.0", | ||
@@ -31,4 +31,4 @@ "semistandard": "^11.0.0" | ||
"engines": { | ||
"node": ">=4" | ||
"node": ">=0.10" | ||
} | ||
} |
@@ -35,2 +35,5 @@ # detect-libc | ||
This feature will always return `false` for `isNonGlibcLinux` | ||
on versions of Node prior to v0.12 as `spawnSync` is unavailable. | ||
### detect-libc command line tool | ||
@@ -44,2 +47,4 @@ | ||
This feature requires `spawnSync` provided by Node v0.12+. | ||
```sh | ||
@@ -46,0 +51,0 @@ detect-libc child-command |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
16412
1
82
5