-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Super preliminary loop that will not even work right w/ libc
- Loading branch information
Showing
5 changed files
with
81 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const process = require('node:process') | ||
|
||
function os () { | ||
return process.platform | ||
} | ||
|
||
function cpu () { | ||
return process.arch | ||
} | ||
|
||
function isMusl (file) { | ||
return file.includes('libc.musl-') || file.includes('ld-musl-') | ||
} | ||
|
||
// libc checks only work in linux, environment and os check needs to happen out of band from this function | ||
function libcFamily () { | ||
let family = null | ||
const report = process.report.getReport() | ||
if (report.header?.glibcVersionRuntime) { | ||
family = 'glibc' | ||
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) { | ||
family = 'musl' | ||
} | ||
return family | ||
} | ||
|
||
module.exports = { | ||
cpu, | ||
libcFamily, | ||
os, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const process = require('node:process') | ||
|
||
function os () { | ||
return process.platform | ||
} | ||
|
||
function cpu () { | ||
return process.arch | ||
} | ||
|
||
function isMusl (file) { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
return file.includes('libc.musl-') || file.includes('ld-musl-') | ||
} | ||
|
||
// libc checks only work in linux, environment and os check needs to happen out of band from this function | ||
function libcFamily (environment) { | ||
let family = null | ||
const report = process.report.getReport() | ||
if (report.header?.glibcVersionRuntime) { | ||
family = 'glibc' | ||
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) { | ||
family = 'musl' | ||
} | ||
return family | ||
} | ||
|
||
module.exports = { | ||
cpu, | ||
libcFamily, | ||
os, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi