MCPcopy Create free account
hub / github.com/ShipSecAI/studio / isLinuxMusl

Function isLinuxMusl

pm2.config.cjs:4–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2const path = require('path');
3
4function isLinuxMusl() {
5 if (process.platform !== 'linux') {
6 return false;
7 }
8
9 try {
10 const report = typeof process.report?.getReport === 'function' ? process.report.getReport() : null;
11 if (report?.header?.glibcVersionRuntime) {
12 return false;
13 }
14 if (Array.isArray(report?.sharedObjects)) {
15 if (report.sharedObjects.some((file) => file.includes('libc.musl-') || file.includes('ld-musl-'))) {
16 return true;
17 }
18 }
19 } catch (_) {
20 // Ignore report inspection errors and continue with filesystem probing.
21 }
22
23 try {
24 const ldd = fs.readFileSync('/usr/bin/ldd', 'utf-8');
25 if (ldd.includes('musl')) {
26 return true;
27 }
28 } catch (_) {
29 // Ignore missing ldd; we'll try the child process fallback.
30 }
31
32 try {
33 const output = require('child_process')
34 .execSync('ldd --version', { encoding: 'utf8' })
35 .toLowerCase();
36 return output.includes('musl');
37 } catch (_) {
38 return false;
39 }
40}
41
42function getSwcTargets() {
43 const { platform, arch } = process;

Callers 1

getSwcTargetsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected