@oxiaom/adoremix 1.0.45 → 1.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/tts/providers/audio8.js +10 -5
package/package.json
CHANGED
package/tts/providers/audio8.js
CHANGED
|
@@ -178,11 +178,16 @@ function detectPkgMgr() {
|
|
|
178
178
|
function which(cmd) {
|
|
179
179
|
try { return execFileSync('command -v ' + cmd, { stdio: 'pipe', encoding: 'utf8' }).trim(); } catch (e) { return null; }
|
|
180
180
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
181
|
+
// 用 try/catch 区分 exit 0 vs 非 0(execFileSync 默认成功也抛错,绕过去)
|
|
182
|
+
function exists(cmd) {
|
|
183
|
+
try { execFileSync('command -v ' + cmd + ' >/dev/null 2>&1', { stdio: 'ignore' }); return true; }
|
|
184
|
+
catch (e) { return false; }
|
|
185
|
+
}
|
|
186
|
+
if (exists('apt-get')) return 'apt';
|
|
187
|
+
if (exists('dnf')) return 'dnf';
|
|
188
|
+
if (exists('yum')) return 'yum';
|
|
189
|
+
if (exists('apk')) return 'apk';
|
|
190
|
+
if (exists('pacman')) return 'pacman';
|
|
186
191
|
return null;
|
|
187
192
|
}
|
|
188
193
|
|