@yixinkj/cli 1.0.6 → 1.0.7
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/index.js +14 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -234,8 +234,21 @@ function chmodExecutables(target) {
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
+
function clearMacQuarantine() {
|
|
238
|
+
if (process.platform !== 'darwin' || !fs.existsSync(BIN_DIR)) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const result = spawnSync('xattr', ['-dr', 'com.apple.quarantine', BIN_DIR], {
|
|
242
|
+
encoding: 'utf8'
|
|
243
|
+
});
|
|
244
|
+
if (result.error && result.error.code !== 'ENOENT') {
|
|
245
|
+
console.error(`[yixin] macOS 安全隔离标记清理失败:${result.error.message}`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
237
249
|
async function ensureInstalled(target) {
|
|
238
250
|
if (isInstalled(target)) {
|
|
251
|
+
clearMacQuarantine();
|
|
239
252
|
chmodExecutables(target);
|
|
240
253
|
return;
|
|
241
254
|
}
|
|
@@ -249,6 +262,7 @@ async function ensureInstalled(target) {
|
|
|
249
262
|
console.error(`[yixin] 正在下载 ${url}`);
|
|
250
263
|
await downloadFile(url, archivePath);
|
|
251
264
|
extractArchive(archivePath, target);
|
|
265
|
+
clearMacQuarantine();
|
|
252
266
|
chmodExecutables(target);
|
|
253
267
|
|
|
254
268
|
for (const name of target.binaries) {
|