fix: use explicit arch parameter for sysproxy node selection

This commit is contained in:
xmk23333 2026-01-15 22:56:37 +08:00
parent 295c4400e9
commit ab58248d7b
2 changed files with 12 additions and 10 deletions

View File

@ -321,10 +321,10 @@ const SYSPROXY_RS_VERSION = 'v0.1.0'
const SYSPROXY_RS_URL_PREFIX = `https://github.com/mihomo-party-org/sysproxy-rs-opti/releases/download/${SYSPROXY_RS_VERSION}`
function getSysproxyNodeName() {
// 检测是否为 musl 系统(与 src/native/sysproxy/index.js 保持一致)
const isMusl = (() => {
if (platform !== 'linux') return false
try {
// 通过 ldd --version 输出判断是否为 musl
const output = execSync('ldd --version 2>&1 || true').toString()
return output.includes('musl')
} catch {

View File

@ -1,4 +1,4 @@
const { existsSync, readFileSync } = require('fs')
const { existsSync } = require('fs')
const { join, dirname } = require('path')
const { platform, arch } = process
@ -7,17 +7,19 @@ let nativeBinding = null
let loadError = null
function isMusl() {
if (!process.report || typeof process.report.getReport !== 'function') {
try {
const lddPath = require('child_process').execSync('which ldd').toString().trim()
return readFileSync(lddPath, 'utf8').includes('musl')
} catch {
return true
}
} else {
// 优先使用 process.reportNode.js 12+,最可靠)
if (process.report && typeof process.report.getReport === 'function') {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
// 备选:检查 ldd --version 输出
try {
const { execSync } = require('child_process')
const output = execSync('ldd --version 2>&1 || true').toString()
return output.includes('musl')
} catch {
return false
}
}
function getBindingName() {