修改配置文件

This commit is contained in:
dinglili 2024-07-31 17:05:00 +08:00 committed by wangpenglong
parent ae65222aa8
commit a1da61b1ba
5 changed files with 261 additions and 196 deletions

View File

@ -1,5 +1,5 @@
{ {
"version":"0.0.2", "version":"0.0.3",
"kylin-ide-lowest-ver":"0.4.0", "kylin-ide-lowest-ver":"0.4.0",
"first_class_list":{ "first_class_list":{
"description":{ "description":{
@ -94,10 +94,10 @@
{ {
"order":1, "order":1,
"postin":"python3-pip" , "postin":"python3-pip" ,
"file_url":"base-url:/python3_config-0.0.1.sh", "file_url":"base-url:/python3_config-0.0.2.sh",
"file_name": "python3_config-0.0.1.sh", "file_name": "python3_config-0.0.2.sh",
"ver": "0.0.1", "ver": "0.0.2",
"sign-md5": "5abef8fab04ca04d2b74531c1e563ceac297e3bdced8df4a519dad90386f25682ec985b008ab73b25254add9ae92f840a1d86a5c4829389d328aa555ef30e792fee4a8beaf3da2ddba2afe19ddfa03898fef102299ef5a8fe2001af394a7e2ecfd0adc63fe4231bc95337909856b438ed73acba41f217c8f0f2ae7640bb2cc78" "sign-md5": "aef9f6ef790eae1249d645dab5c7faab19896a5e9357b4e058dddd74b2bff7d8ed5c793196d1e12b27608423931f54f55304be1faa439e21ff44d967477fa9dc9550db1a5a8605ab9e5cac3448095d9d1831b880b574dc63724bcd47c834f6865c98a26bbdbc6290f65b09ca8b45c80b6eed7caf978cd25cde28512daed2823d"
} }
] ]
}, },
@ -122,10 +122,10 @@
{ {
"order":1, "order":1,
"postin":"golang-1.14", "postin":"golang-1.14",
"file_url":"base-url:/go_config-0.0.1.js", "file_url":"base-url:/go_config-0.0.2.js",
"file_name": "go_config-0.0.1.js", "file_name": "go_config-0.0.2.js",
"ver": "0.0.1", "ver": "0.0.2",
"sign-md5": "cd79e95d69868f87caca7197e68597e29a4ac9c6fce6134ba174e2f8331e372e6e7598d5e769b9dd06f8f99a82dfa5cb8602e7b17cd63e330273a7f1bb0befe25d3101ddddc7b11546cb9dfd7bf9266d5ffc0e2fc460e3bb074aba311f0ec6c930d85f61a7f4db0b473400863204b13a6f0d08749193fbaf190fafa72d340054" "sign-md5": "a54150fd8eab3d686f3eee0e70215030bb0d886ecae1aced4dc0b6feccc4340f6f68812360ce1ad7c0c2c7317871dc2ee245c81aa6c122d119b06ba93c28ef85af75de42362553571ba935fef147d901005f1b36eda0f83e92d42462e0bd219d5d67812e1f89287b20eb632a42478f2f63a10688f5ec837ca35d050fdeac9936"
} }
] ]
}, },

View File

@ -1,5 +1,5 @@
{ {
"version": "0.0.1", "version": "0.0.2",
"KylinIdeTeam.extension-dependency": { "KylinIdeTeam.extension-dependency": {
"ext_id": "KylinIdeTeam.extension-dependency", "ext_id": "KylinIdeTeam.extension-dependency",
"ext_name": "extension dependency", "ext_name": "extension dependency",
@ -315,5 +315,51 @@
"repo": "remote-dev" "repo": "remote-dev"
} }
} }
},
"ms-vscode.cmake-tools": {
"ext_id": "ms-vscode.cmake-tools",
"ext_name": "CMake Tools",
"ext_descrip": {
"en": "CMake Tools",
"zh_cn": "CMake工具"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "mu_ruichao",
"repo": "exts"
} }
}
},
"KylinIdeTeam.qmake-tools": {
"ext_id": "KylinIdeTeam.qmake-tools",
"ext_name": "QMake Tools",
"ext_descrip": {
"en": "QMake Tools",
"zh_cn": "QMake工具"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-qmake-tools"
}
}
},
"KylinIdeTeam.qt-support": {
"ext_id": "KylinIdeTeam.qt-support",
"ext_name": "Qt Support",
"ext_descrip": {
"en": "Qt Support",
"zh_cn": "Qt 支持"
},
"ext_links": {
"gitee": {
"prefix": "https://gitee.com",
"org": "openkylin",
"repo": "ide-qt-support"
}
}
}
} }

View File

@ -1,11 +1,11 @@
{ {
"ver": "0.0.2", "ver": "0.0.3",
"base-url":"https://gitee.com/openkylin/extensions-repo/raw/master/inst-configs-repo/kylin-code/config", "base-url":"https://gitee.com/openkylin/extensions-repo/raw/master/inst-configs-repo/kylin-code/0.4.0",
"ext-file": { "ext-file": {
"file_url": "base-url:/ext_link_address-0.0.1.json", "file_url": "base-url:/ext_link_address-0.0.2.json",
"file_name": "ext_link_address-0.0.1.json", "file_name": "ext_link_address-0.0.2.json",
"ver": "0.0.1", "ver": "0.0.2",
"sign-md5": "a57db37948052f7d03f102c16be8867a17a3b2b171bf75add8dd3d4f2b0774198e858c58792c7517fd875109eb8fee5206011c7635c87437e3d645d9b18102cfae988e2d2fc4a387cb6bbf49241b9e8fd2189ebae46633fa4bddc68912b849c07ab278eaba2adaadd260b122c7998b56b6e3308fdfdad57289522c66e8534f4d" "sign-md5": "1697c442da9dd290ef353a230f6de2e926d7b82c650e20a72042bef82ee908a1ced3f82b1905886d3e061eb7c96082e3fb6148f56cdd8486e5bbc470cd9f1d75d2ee69d08e8ba68df498da5203f4ad85c27f50386032e6cb3893a6dd04060ee358db33fca360d9e0d523852870563bd4ded45dbe2adf9e710a3db7719c7e74f6"
}, },
"match-script": "match-script":
{ {
@ -21,11 +21,11 @@
"en": "X86 openKylin Desktop", "en": "X86 openKylin Desktop",
"zh_cn": "X86 openKylin开源操作系统" "zh_cn": "X86 openKylin开源操作系统"
}, },
"file_url": "base-url:/desktop_os_common-0.0.2.json", "file_url": "base-url:/desktop_os_common-0.0.3.json",
"file_name": "desktop_os_common-0.0.2.json", "file_name": "desktop_os_common-0.0.3.json",
"ver": "0.0.2", "ver": "0.0.3",
"kylin-ide-lowest-ver": "0.4.0", "kylin-ide-lowest-ver": "0.4.0",
"sign-md5":"0ea2ff6a15c6cb6ae894773771cbbc8eba5d4406a5a86c7a07ee6784fcd3b1c7cc71c874de8fdceec96265391a31bd2fe20bcbbb24cef8892410b6ce5e133c21454c73e7a3992b67569e7a6f228eebf2face8b4335b9c7e80e9a22eff42ff185dc89b06ce5b1124b752fbc1d6eff8a3e925f27d95bad0f82b00ec5c6b8fe068a" "sign-md5":"1b8df34d441b8a1b4bb6859164a661c5ee1984193e361da3ae0ad7fc123c76a21c11f75b2d1926b9d71bfb2a9e59f0d07e1fe8efabdabbc37bf463904fb3e4243ec4e5340a92ae245910372349b972beb08fbd72f47984acbcaac2527fc7ff1605626e996d00a5b0f4b9d4a22ece22afc647d34627e96c4f22c1c043b845a20b"
} }
] ]
} }

View File

@ -2,7 +2,7 @@ const { exec, spawnSync, spawn, execSync } = require('child_process');
const os = require('os'); const os = require('os');
const fs = require('fs'); const fs = require('fs');
//go工具安装 //go工具安装
function GoToolsInstall(archName, goVersion, goPath, systemtype) { function GoToolsInstall(archName, goVersion, goPath, systemtype,controller) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
let installToolsMessage = ''; let installToolsMessage = '';
let codeProcess = 0 let codeProcess = 0
@ -12,29 +12,23 @@ function GoToolsInstall(archName, goVersion, goPath, systemtype) {
case '1.13': case '1.13':
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:")
try { try {
await gopls095Install(goPath) await gopls095Install(goPath,controller)
.then(([results, code]) => { .then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return dlv160Install(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n' installToolsMessage += results + '\n'
codeProcess += code codeProcess += code
}) }).catch((error) => {
.catch((error) => { reject(error);
console.error(error);
}); });
await dlv160Install(goPath) })
.then(([results, code]) => {
installToolsMessage += results + '\n'
codeProcess += code
}) })
.catch((error) => { .catch((error) => {
console.error(error); reject(error);
});
await goOutLineInstall(goPath)
.then(([results, code]) => {
installToolsMessage += results + '\n'
codeProcess += code
})
.catch((error) => {
console.error(error);
}); });
resolve([installToolsMessage, codeProcess]) resolve([installToolsMessage, codeProcess])
@ -48,62 +42,53 @@ function GoToolsInstall(archName, goVersion, goPath, systemtype) {
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:")
try { try {
await gopls095Install(goPath) await gopls095Install(goPath,controller)
.then(([results, code]) => { .then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return dlv161Install(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n' installToolsMessage += results + '\n'
codeProcess += code codeProcess += code
}).catch((error) => {
reject(error);
});
})
}) })
.catch((error) => { .catch((error) => {
console.error(error); reject(error);
});
await dlv161Install(goPath)
.then(([results, code]) => {
installToolsMessage += results + '\n'
codeProcess += code
})
.catch((error) => {
console.error(error);
});
await goOutLineInstall(goPath)
.then(([results, code]) => {
installToolsMessage += results + '\n'
codeProcess += code
})
.catch((error) => {
console.error(error);
}); });
resolve([installToolsMessage, codeProcess]) resolve([installToolsMessage, codeProcess])
} catch (error) { } catch (error) {
console.log("Go工具安裝失败:", error) console.log("Go工具安裝失败:", error);
reject(error);
} }
return return
case '1.15': case '1.15':
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:")
try { try {
await gopls095Install(goPath) await gopls095Install(goPath,controller)
.then(([results, code]) => { .then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return dlv161Install(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n' installToolsMessage += results + '\n'
codeProcess += code codeProcess += code
}).catch((error) => {
reject(error);
});
})
}) })
.catch((error) => { .catch((error) => {
console.error(error); reject(error);
});
await dlv161Install(goPath)
.then(([results, code]) => {
installToolsMessage += results + '\n'
codeProcess += code
})
.catch((error) => {
console.error(error);
});
await goOutLineInstall(goPath)
.then(([results, code]) => {
installToolsMessage += results + '\n'
codeProcess += code
})
.catch((error) => {
console.error(error);
}); });
resolve([installToolsMessage, codeProcess]) resolve([installToolsMessage, codeProcess])
} catch (error) { } catch (error) {
console.log("Go工具安裝失败:", error) console.log("Go工具安裝失败:", error)
@ -113,33 +98,28 @@ function GoToolsInstall(archName, goVersion, goPath, systemtype) {
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go工具:") console.log("正在", archName, "架构,", systemtype, "系统类型上安装go工具:")
installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go工具:" + '\n'; installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go工具:" + '\n';
try { try {
await goplsInstall(goPath) await goplsInstall(goPath,controller)
.then(([results, code]) => { .then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return dlvInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n' installToolsMessage += results + '\n'
codeProcess += code codeProcess += code
}) }).catch((error) => {
.catch((error) => { reject(error);
console.error(error);
}); });
await dlvInstall(goPath) })
.then(([results, code]) => {
installToolsMessage += results + '\n'
codeProcess += code
}) })
.catch((error) => { .catch((error) => {
console.error(error); reject(error);
});
await goOutLineInstall(goPath)
.then(([results, code]) => {
installToolsMessage += results + '\n'
codeProcess += code
})
.catch((error) => {
console.error(error);
}); });
resolve([installToolsMessage, codeProcess]) resolve([installToolsMessage, codeProcess])
} catch (error) { } catch (error) {
console.log("Go工具安裝失败:", error) console.log("Go工具安裝失败:", error)
reject(error);
} }
} }
} else { } else {
@ -148,75 +128,73 @@ function GoToolsInstall(archName, goVersion, goPath, systemtype) {
case '1.15': case '1.15':
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:")
try { try {
await gopls095Install(goPath) await gopls095Install(goPath,controller)
.then(([results, code]) => { .then(([results, code,signal]) => {
installToolsMessage += results + '\n' installToolsMessage += results + '\n'
codeProcess += code codeProcess += code
}) return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
.catch((error) => {
console.error(error);
});
await goOutLineInstall(goPath)
.then(([results, code]) => {
installToolsMessage += results + '\n' installToolsMessage += results + '\n'
codeProcess += code codeProcess += code
}).catch((error) => {
reject(error);
});
}) })
.catch((error) => { .catch((error) => {
console.error(error); reject(error);
}); });
resolve([installToolsMessage, codeProcess]) resolve([installToolsMessage, codeProcess])
} catch (error) { } catch (error) {
console.log("Go工具安裝失败:", error) reject(error);
} }
return return
case '1.14': case '1.14':
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:")
try { try {
await gopls095Install(goPath) await gopls095Install(goPath,controller)
.then(([results, code]) => { .then(([results, code,signal]) => {
installToolsMessage += results + '\n' installToolsMessage += results + '\n'
codeProcess += code codeProcess += code
}) return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
.catch((error) => { installToolsMessage += results + '\n'
console.error(error); codeProcess += code
}).catch((error) => {
reject(error);
}); });
await goOutLineInstall(goPath)
.then(([results, code]) => {
installToolsMessage += results + '\n'
codeProcess += code
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
reject(error);
}); });
resolve([installToolsMessage, codeProcess]) resolve([installToolsMessage, codeProcess])
} catch (error) { } catch (error) {
console.log("Go工具安裝失败:", error) console.log("Go工具安裝失败:", error);
reject(error);
} }
return return
case '1.13': case '1.13':
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:")
try { try {
await gopls095Install(goPath) await gopls095Install(goPath,controller)
.then(([results, code]) => { .then(([results, code,signal]) => {
installToolsMessage += results + '\n' installToolsMessage += results + '\n'
codeProcess += code codeProcess += code
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code
}).catch((error) => {
reject(error);
});
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
reject(error);
}); });
await goOutLineInstall(goPath)
.then(([results, code]) => {
installToolsMessage += results + '\n'
codeProcess += code
})
.catch((error) => {
console.error(error);
});
resolve([installToolsMessage, codeProcess])
} catch (error) { } catch (error) {
console.log("Go工具安裝失败:", error) console.log("Go工具安裝失败:", error)
reject(error);
} }
return return
@ -224,25 +202,25 @@ function GoToolsInstall(archName, goVersion, goPath, systemtype) {
console.log("正在", archName, "架构,", systemtype, "系统类型上安装go工具:") console.log("正在", archName, "架构,", systemtype, "系统类型上安装go工具:")
installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go工具" + '\n'; installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go工具" + '\n';
try { try {
await goplsInstall(goPath) await goplsInstall(goPath,controller)
.then(([results, code]) => { .then(([results, code,signal]) => {
installToolsMessage += results + '\n'
codeProcess += code;
return goOutLineInstall(goPath,controller). then(([results, code,signal]) => {
installToolsMessage += results + '\n' installToolsMessage += results + '\n'
codeProcess += code codeProcess += code
}) }).catch((error) => {
.catch((error) => { reject(error);
console.error(error);
}); });
await goOutLineInstall(goPath)
.then(([results, code]) => {
installToolsMessage += results + '\n'
codeProcess += code
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
reject(error);
}); });
resolve([installToolsMessage, codeProcess]) resolve([installToolsMessage, codeProcess])
} catch (error) { } catch (error) {
console.log("Go工具安裝失败:", error) console.log("Go工具安裝失败:", error);
reject(error);
} }
} }
@ -266,131 +244,170 @@ function executableFileExists(filePath) {
return exists; return exists;
} }
//下载gopls@0.9.5 //下载gopls@0.9.5
function gopls095Install(goPath) { function gopls095Install(goPath,controller) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const ls = spawn(goPath, ["get", "-v", "golang.org/x/tools/gopls@v0.9.5"]); const ls = spawn(goPath, ["get", "-v", "golang.org/x/tools/gopls@v0.9.5"],{detached:true,shell:true});
ls.stderr.on('data', (data) => { console.error(`${data}`); }); ls.stderr.on('data', (data) => { console.error(`${data}`); });
ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); });
ls.on('close', (code) => { ls.on('close', (code,signal) => {
console.log(`子进程退出码:${code}`); console.log(`子进程退出码:${code}`);
controller.signal.removeEventListener('abort', cancelTask);
if (code === 0) { if (code === 0) {
console.log("gopls@v0.9.5安装成功"); console.log("gopls@v0.9.5安装成功");
resolve(["gopls@v0.9.5安装成功", code]); resolve(["gopls@v0.9.5安装成功", code,signal]);
} else { } else {
console.log("gopls@v0.9.5安装失败"); console.log("gopls@v0.9.5安装失败");
resolve(["gopls@v0.9.5安装失败", code]); reject(["gopls@v0.9.5安装失败", code,signal]);
} }
}); });
const cancelTask=()=>{
if(ls.pid){
execSync(`kill -9 -${ls.pid}`);
}
}
controller.signal.addEventListener('abort', cancelTask);
}) })
} }
//下载gopls //下载gopls
function goplsInstall(goPath) { function goplsInstall(goPath,controller) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const ls = spawn(goPath, ["get", "-v", "golang.org/x/tools/gopls"]); const ls = spawn(goPath, ["get", "-v", "golang.org/x/tools/gopls"],{detached:true,shell:true});
ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); });
ls.stderr.on('data', (data) => { console.error(`${data}`); }); ls.stderr.on('data', (data) => { console.error(`${data}`); });
ls.on('close', (code) => { ls.on('close', (code,signal) => {
console.log(`子进程退出码:${code}`); console.log(`子进程退出码:${code}`);
controller.signal.removeEventListener('abort', cancelTask);
if (code === 0) { if (code === 0) {
console.log("gopls安装成功"); console.log("gopls安装成功");
resolve(["gopls安装成功", code]); resolve(["gopls安装成功", code,signal]);
} else { }else {
console.log("gopls安装失败"); console.log("gopls安装失败");
resolve(["gopls安装失败", code]); reject(["gopls安装失败", code,signal]);
} }
}); });
const cancelTask=()=>{
if(ls.pid){
execSync(`kill -9 -${ls.pid}`);
}
}
controller.signal.addEventListener('abort', cancelTask);
}) })
} }
//下载dlv@1.6.0 //下载dlv@1.6.0
function dlv160Install(goPath) { function dlv160Install(goPath,controller) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const ls = spawn(goPath, ["get", "-v", "github.com/go-delve/delve/cmd/dlv@v1.6.0"]); const ls = spawn(goPath, ["get", "-v", "github.com/go-delve/delve/cmd/dlv@v1.6.0"],{detached:true,shell:true});
ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); });
ls.stderr.on('data', (data) => { console.error(`${data}`); }); ls.stderr.on('data', (data) => { console.error(`${data}`); });
ls.on('close', (code) => { ls.on('close', (code,signal) => {
console.log(`子进程退出码:${code}`); console.log(`子进程退出码:${code}`);
controller.signal.removeEventListener('abort', cancelTask);
if (code === 0) { if (code === 0) {
console.log("dlv@v1.6.0安装成功"); console.log("dlv@v1.6.0安装成功");
resolve(["dlv@v1.6.0安装成功", code]); resolve(["dlv@v1.6.0安装成功", code,signal]);
} else { } else {
console.log("dlv@v1.6.0安装失败"); console.log("dlv@v1.6.0安装失败");
resolve(["dlv@v1.6.0安装失败", code]); reject(["dlv@v1.6.0安装失败", code,signal]);
} }
}); });
const cancelTask=()=>{
if(ls.pid){
execSync(`kill -9 -${ls.pid}`);
}
}
controller.signal.addEventListener('abort', cancelTask);
}) })
} }
//下载dlv@1.6.1 //下载dlv@1.6.1
function dlv161Install(goPath) { function dlv161Install(goPath,controller) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const ls = spawn(goPath, ["get", "-v", "github.com/go-delve/delve/cmd/dlv@v1.6.1"]); const ls = spawn(goPath, ["get", "-v", "github.com/go-delve/delve/cmd/dlv@v1.6.1"],{detached:true,shell:true});
ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); });
ls.stderr.on('data', (data) => { console.error(`${data}`); }); ls.stderr.on('data', (data) => { console.error(`${data}`); });
ls.on('close', (code) => { ls.on('close', (code,signal) => {
console.log(`子进程退出码:${code}`); console.log(`子进程退出码:${code}`);
controller.signal.removeEventListener('abort', cancelTask);
if (code === 0) { if (code === 0) {
console.log("dlv@v1.6.1安装成功"); console.log("dlv@v1.6.1安装成功");
resolve(["dlv@v1.6.1安装成功", code]) resolve(["dlv@v1.6.1安装成功", code,signal])
} else { }else {
console.log("dlv@v1.6.1安装失败"); console.log("dlv@v1.6.1安装失败");
resolve(["dlv@v1.6.1安装失败", code]) reject(["dlv@v1.6.1安装失败", code,signal])
} }
}); });
const cancelTask=()=>{
if(ls.pid){
execSync(`kill -9 -${ls.pid}`);
}
}
controller.signal.addEventListener('abort', cancelTask);
}) })
} }
//下载dlv //下载dlv
function dlvInstall(goPath) { function dlvInstall(goPath,controller) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const ls = spawn(goPath, ["get", "-v", "github.com/go-delve/delve/cmd/dlv"]); const ls = spawn(goPath, ["get", "-v", "github.com/go-delve/delve/cmd/dlv"],{detached:true,shell:true});
ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); });
ls.stderr.on('data', (data) => { console.error(`${data}`); }); ls.stderr.on('data', (data) => { console.error(`${data}`); });
ls.on('close', (code) => { ls.on('close', (code,signal) => {
console.log(`子进程退出码:${code}`); console.log(`子进程退出码:${code}`);
controller.signal.removeEventListener('abort', cancelTask);
if (code === 0) { if (code === 0) {
console.log("dlv安装成功"); console.log("dlv安装成功");
resolve(["dlv安装成功", code]) resolve(["dlv安装成功", code,signal])
} else { } else {
console.log("dlv安装失败"); console.log("dlv安装失败");
resolve(["dlv安装失败", code]) reject(["dlv安装失败", code,signal])
} }
}); });
const cancelTask=()=>{
if(ls.pid){
execSync(`kill -9 -${ls.pid}`);
}
}
controller.signal.addEventListener('abort', cancelTask);
}) })
} }
//下载go-outline //下载go-outline
function goOutLineInstall(goPath) { function goOutLineInstall(goPath,controller) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const ls = spawn(goPath, ["get", "-v", "github.com/ramya-rao-a/go-outline"]); const ls = spawn(goPath, ["get", "-v", "github.com/ramya-rao-a/go-outline"],{detached:true,shell:true});
ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); });
ls.stderr.on('data', (data) => { console.error(`${data}`); }); ls.stderr.on('data', (data) => { console.error(`${data}`); });
ls.on('close', (code) => { ls.on('close', (code,signal) => {
controller.signal.removeEventListener('abort', cancelTask);
console.log(`子进程退出码:${code}`); console.log(`子进程退出码:${code}`);
if (code === 0) { if (code === 0) {
console.log("go-outline安装成功"); console.log("go-outline安装成功");
resolve(["go-outline安装成功", code]) resolve(["go-outline安装成功", code,signal])
} else { } else {
console.log("go-outline安装失败"); console.log("go-outline安装失败");
resolve(["go-outline安装失败", code]) reject(["go-outline安装失败", code,signal])
} }
}); });
const cancelTask=()=>{
if(ls.pid){
execSync(`kill -9 -${ls.pid}`);
}
}
controller.signal.addEventListener('abort', cancelTask);
}) })
} }
//获取go路径以及版本号 //获取go路径以及版本号
@ -453,7 +470,7 @@ function checkSystemType() {
} }
async function main() { async function main(controller) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let goVersion = ""; let goVersion = "";
let goPath = ""; let goPath = "";
@ -489,12 +506,14 @@ async function main() {
}) })
p.then(async (value) => { p.then(async (value) => {
if (goPath !== "") { if (goPath !== "") {
GoToolsInstall(archName, goVersion, goPath, systemtype) GoToolsInstall(archName, goVersion, goPath, systemtype,controller)
.then(([results, code]) => { .then(([results, code]) => {
resolve([results, code]) resolve([results, code])
}) }).catch((error) => {
reject(error);
});
} else { } else {
console.log("找不到go路径") reject("找不到go路径")
} }
@ -502,7 +521,7 @@ async function main() {
}) })
} }
// main();
module.exports = { module.exports = {
main main
} }

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
echo "exec \"pip3 install pylint -i https://pypi.tuna.tsinghua.edu.cn/simple\"" echo "exec \"pip3 install pylint -i https://pypi.tuna.tsinghua.edu.cn/simple\""
pip3 install pylint -i https://pypi.tuna.tsinghua.edu.cn/simple pip3 install pylint -break-system-packages -i https://pypi.tuna.tsinghua.edu.cn/simple