Skip to content

Commit

Permalink
fix(cli): handle lld not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jan 3, 2022
1 parent 671ac80 commit eb79cce
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions cli/src/js-binding-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,22 @@ const { platform, arch } = process
let nativeBinding = null
let localFileExisted = false
let isMusl = false
let loadError = null
function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
} catch (e) {
return false
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !Boolean(glibcVersionRuntime)
}
}
switch (platform) {
case 'android':
if (arch !== 'arm64') {
Expand Down Expand Up @@ -125,8 +138,7 @@ switch (platform) {
case 'linux':
switch (arch) {
case 'x64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, '${localName}.linux-x64-musl.node')
)
Expand Down Expand Up @@ -155,8 +167,7 @@ switch (platform) {
}
break
case 'arm64':
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
if (isMusl) {
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, '${localName}.linux-arm64-musl.node')
)
Expand Down

0 comments on commit eb79cce

Please sign in to comment.