diff --git a/installwizard/config/desktop_os_common-0.0.2.json b/installwizard/config/desktop_os_common-0.0.3.json similarity index 89% rename from installwizard/config/desktop_os_common-0.0.2.json rename to installwizard/config/desktop_os_common-0.0.3.json index ca839758..eaabd9b9 100644 --- a/installwizard/config/desktop_os_common-0.0.2.json +++ b/installwizard/config/desktop_os_common-0.0.3.json @@ -1,5 +1,5 @@ { - "version":"0.0.2", + "version":"0.0.3", "kylin-ide-lowest-ver":"0.4.0", "first_class_list":{ "description":{ @@ -94,10 +94,10 @@ { "order":1, "postin":"python3-pip" , - "file_url":"base-url:/python3_config-0.0.1.sh", - "file_name": "python3_config-0.0.1.sh", - "ver": "0.0.1", - "sign-md5": "5abef8fab04ca04d2b74531c1e563ceac297e3bdced8df4a519dad90386f25682ec985b008ab73b25254add9ae92f840a1d86a5c4829389d328aa555ef30e792fee4a8beaf3da2ddba2afe19ddfa03898fef102299ef5a8fe2001af394a7e2ecfd0adc63fe4231bc95337909856b438ed73acba41f217c8f0f2ae7640bb2cc78" + "file_url":"base-url:/python3_config-0.0.2.sh", + "file_name": "python3_config-0.0.2.sh", + "ver": "0.0.2", + "sign-md5": "aef9f6ef790eae1249d645dab5c7faab19896a5e9357b4e058dddd74b2bff7d8ed5c793196d1e12b27608423931f54f55304be1faa439e21ff44d967477fa9dc9550db1a5a8605ab9e5cac3448095d9d1831b880b574dc63724bcd47c834f6865c98a26bbdbc6290f65b09ca8b45c80b6eed7caf978cd25cde28512daed2823d" } ] }, @@ -122,10 +122,10 @@ { "order":1, "postin":"golang-1.14", - "file_url":"base-url:/go_config-0.0.1.js", - "file_name": "go_config-0.0.1.js", - "ver": "0.0.1", - "sign-md5": "cd79e95d69868f87caca7197e68597e29a4ac9c6fce6134ba174e2f8331e372e6e7598d5e769b9dd06f8f99a82dfa5cb8602e7b17cd63e330273a7f1bb0befe25d3101ddddc7b11546cb9dfd7bf9266d5ffc0e2fc460e3bb074aba311f0ec6c930d85f61a7f4db0b473400863204b13a6f0d08749193fbaf190fafa72d340054" + "file_url":"base-url:/go_config-0.0.2.js", + "file_name": "go_config-0.0.2.js", + "ver": "0.0.2", + "sign-md5": "a54150fd8eab3d686f3eee0e70215030bb0d886ecae1aced4dc0b6feccc4340f6f68812360ce1ad7c0c2c7317871dc2ee245c81aa6c122d119b06ba93c28ef85af75de42362553571ba935fef147d901005f1b36eda0f83e92d42462e0bd219d5d67812e1f89287b20eb632a42478f2f63a10688f5ec837ca35d050fdeac9936" } ] }, diff --git a/installwizard/config/ext_link_address-0.0.1.json b/installwizard/config/ext_link_address-0.0.2.json similarity index 88% rename from installwizard/config/ext_link_address-0.0.1.json rename to installwizard/config/ext_link_address-0.0.2.json index 9497028b..3335d604 100644 --- a/installwizard/config/ext_link_address-0.0.1.json +++ b/installwizard/config/ext_link_address-0.0.2.json @@ -1,5 +1,5 @@ { - "version": "0.0.1", + "version": "0.0.2", "KylinIdeTeam.extension-dependency": { "ext_id": "KylinIdeTeam.extension-dependency", "ext_name": "extension dependency", @@ -315,5 +315,51 @@ "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" + } + } } + } \ No newline at end of file diff --git a/installwizard/config/g_index.json b/installwizard/config/g_index.json index 1b78b994..6f6fb3fc 100644 --- a/installwizard/config/g_index.json +++ b/installwizard/config/g_index.json @@ -1,18 +1,18 @@ { - "ver": "0.0.2", - "base-url":"https://gitee.com/openkylin/extensions-repo/raw/master/inst-configs-repo/kylin-code/config", + "ver": "0.0.3", + "base-url":"https://gitee.com/openkylin/extensions-repo/raw/master/inst-configs-repo/kylin-code/0.4.0", "ext-file": { - "file_url": "base-url:/ext_link_address-0.0.1.json", - "file_name": "ext_link_address-0.0.1.json", - "ver": "0.0.1", - "sign-md5": "a57db37948052f7d03f102c16be8867a17a3b2b171bf75add8dd3d4f2b0774198e858c58792c7517fd875109eb8fee5206011c7635c87437e3d645d9b18102cfae988e2d2fc4a387cb6bbf49241b9e8fd2189ebae46633fa4bddc68912b849c07ab278eaba2adaadd260b122c7998b56b6e3308fdfdad57289522c66e8534f4d" + "file_url": "base-url:/ext_link_address-0.0.2.json", + "file_name": "ext_link_address-0.0.2.json", + "ver": "0.0.2", + "sign-md5": "1697c442da9dd290ef353a230f6de2e926d7b82c650e20a72042bef82ee908a1ced3f82b1905886d3e061eb7c96082e3fb6148f56cdd8486e5bbc470cd9f1d75d2ee69d08e8ba68df498da5203f4ad85c27f50386032e6cb3893a6dd04060ee358db33fca360d9e0d523852870563bd4ded45dbe2adf9e710a3db7719c7e74f6" }, "match-script": { "file_url": "base-url:/os_classify_script-0.0.2.js", "file_name": "os_classify_script-0.0.2.js", - "ver": "0.0.2", - "sign-md5": "844d390832ab4e5fa9576e60f348a10cbd6474bff8a7af773d53a11243a0bb1e0f057ba5ba564516d25b8fe1e05b25a7540e2f037d26a574e2d6c2e1659f32425050cb3b7b39aea8ede59f165b3ed19a096100934970a1a1e6499dd32f82d20eb9a711dc449e6de3a45c10f75ec51c7c7b28e1851b50250499560b9d7eb2e826" + "ver": "0.0.2", + "sign-md5": "844d390832ab4e5fa9576e60f348a10cbd6474bff8a7af773d53a11243a0bb1e0f057ba5ba564516d25b8fe1e05b25a7540e2f037d26a574e2d6c2e1659f32425050cb3b7b39aea8ede59f165b3ed19a096100934970a1a1e6499dd32f82d20eb9a711dc449e6de3a45c10f75ec51c7c7b28e1851b50250499560b9d7eb2e826" }, "config-file": { "x86_openkylin_desktop": [ @@ -21,12 +21,12 @@ "en": "X86 openKylin Desktop", "zh_cn": "X86 openKylin开源操作系统" }, - "file_url": "base-url:/desktop_os_common-0.0.2.json", - "file_name": "desktop_os_common-0.0.2.json", - "ver": "0.0.2", + "file_url": "base-url:/desktop_os_common-0.0.3.json", + "file_name": "desktop_os_common-0.0.3.json", + "ver": "0.0.3", "kylin-ide-lowest-ver": "0.4.0", - "sign-md5":"0ea2ff6a15c6cb6ae894773771cbbc8eba5d4406a5a86c7a07ee6784fcd3b1c7cc71c874de8fdceec96265391a31bd2fe20bcbbb24cef8892410b6ce5e133c21454c73e7a3992b67569e7a6f228eebf2face8b4335b9c7e80e9a22eff42ff185dc89b06ce5b1124b752fbc1d6eff8a3e925f27d95bad0f82b00ec5c6b8fe068a" + "sign-md5":"1b8df34d441b8a1b4bb6859164a661c5ee1984193e361da3ae0ad7fc123c76a21c11f75b2d1926b9d71bfb2a9e59f0d07e1fe8efabdabbc37bf463904fb3e4243ec4e5340a92ae245910372349b972beb08fbd72f47984acbcaac2527fc7ff1605626e996d00a5b0f4b9d4a22ece22afc647d34627e96c4f22c1c043b845a20b" } ] } -} +} \ No newline at end of file diff --git a/installwizard/config/go_config-0.0.1.js b/installwizard/config/go_config-0.0.2.js similarity index 55% rename from installwizard/config/go_config-0.0.1.js rename to installwizard/config/go_config-0.0.2.js index dab8ec53..b80e05b6 100644 --- a/installwizard/config/go_config-0.0.1.js +++ b/installwizard/config/go_config-0.0.2.js @@ -2,7 +2,7 @@ const { exec, spawnSync, spawn, execSync } = require('child_process'); const os = require('os'); const fs = require('fs'); //go工具安装 -function GoToolsInstall(archName, goVersion, goPath, systemtype) { +function GoToolsInstall(archName, goVersion, goPath, systemtype,controller) { return new Promise(async (resolve, reject) => { let installToolsMessage = ''; let codeProcess = 0 @@ -12,31 +12,25 @@ function GoToolsInstall(archName, goVersion, goPath, systemtype) { case '1.13': console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") try { - await gopls095Install(goPath) - .then(([results, code]) => { + await gopls095Install(goPath,controller) + .then(([results, code,signal]) => { installToolsMessage += results + '\n' - codeProcess += code + 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' + codeProcess += code + }).catch((error) => { + reject(error); + }); + }) }) .catch((error) => { - console.error(error); + reject(error); }); - await dlv160Install(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]) } catch (error) { @@ -48,62 +42,53 @@ function GoToolsInstall(archName, goVersion, goPath, systemtype) { console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") try { - await gopls095Install(goPath) - .then(([results, code]) => { + await gopls095Install(goPath,controller) + .then(([results, code,signal]) => { installToolsMessage += results + '\n' - codeProcess += code + 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' + codeProcess += code + }).catch((error) => { + reject(error); + }); + }) }) .catch((error) => { - console.error(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); + reject(error); }); + resolve([installToolsMessage, codeProcess]) } catch (error) { - console.log("Go工具安裝失败:", error) + console.log("Go工具安裝失败:", error); + reject(error); } return case '1.15': console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") try { - await gopls095Install(goPath) - .then(([results, code]) => { + await gopls095Install(goPath,controller) + .then(([results, code,signal]) => { installToolsMessage += results + '\n' - codeProcess += code + 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' + codeProcess += code + }).catch((error) => { + reject(error); + }); + }) }) .catch((error) => { - console.error(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); + reject(error); }); + resolve([installToolsMessage, codeProcess]) } catch (error) { console.log("Go工具安裝失败:", error) @@ -113,33 +98,28 @@ function GoToolsInstall(archName, goVersion, goPath, systemtype) { console.log("正在", archName, "架构,", systemtype, "系统类型上安装go工具:") installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go工具:" + '\n'; try { - await goplsInstall(goPath) - .then(([results, code]) => { + await goplsInstall(goPath,controller) + .then(([results, code,signal]) => { installToolsMessage += results + '\n' - codeProcess += code + 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' + codeProcess += code + }).catch((error) => { + reject(error); + }); + }) }) .catch((error) => { - console.error(error); - }); - await dlvInstall(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); + reject(error); }); resolve([installToolsMessage, codeProcess]) } catch (error) { console.log("Go工具安裝失败:", error) + reject(error); } } } else { @@ -148,75 +128,73 @@ function GoToolsInstall(archName, goVersion, goPath, systemtype) { case '1.15': console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") try { - await gopls095Install(goPath) - .then(([results, code]) => { + await gopls095Install(goPath,controller) + .then(([results, code,signal]) => { installToolsMessage += results + '\n' codeProcess += code + return goOutLineInstall(goPath,controller). then(([results, code,signal]) => { + installToolsMessage += results + '\n' + codeProcess += code + }).catch((error) => { + reject(error); + }); }) .catch((error) => { - console.error(error); - }); - await goOutLineInstall(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); + reject(error); }); + resolve([installToolsMessage, codeProcess]) } catch (error) { - console.log("Go工具安裝失败:", error) + reject(error); } return case '1.14': console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") try { - await gopls095Install(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await goOutLineInstall(goPath) - .then(([results, code]) => { + await gopls095Install(goPath,controller) + .then(([results, code,signal]) => { installToolsMessage += results + '\n' codeProcess += code + return goOutLineInstall(goPath,controller). then(([results, code,signal]) => { + installToolsMessage += results + '\n' + codeProcess += code + }).catch((error) => { + reject(error); + }); }) .catch((error) => { console.error(error); + reject(error); }); resolve([installToolsMessage, codeProcess]) } catch (error) { - console.log("Go工具安裝失败:", error) + console.log("Go工具安裝失败:", error); + reject(error); } return case '1.13': console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") try { - await gopls095Install(goPath) - .then(([results, code]) => { + await gopls095Install(goPath,controller) + .then(([results, code,signal]) => { installToolsMessage += results + '\n' codeProcess += code + return goOutLineInstall(goPath,controller). then(([results, code,signal]) => { + installToolsMessage += results + '\n' + codeProcess += code + }).catch((error) => { + reject(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]) } catch (error) { console.log("Go工具安裝失败:", error) + reject(error); } return @@ -224,25 +202,25 @@ function GoToolsInstall(archName, goVersion, goPath, systemtype) { console.log("正在", archName, "架构,", systemtype, "系统类型上安装go工具:") installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go工具" + '\n'; try { - await goplsInstall(goPath) - .then(([results, code]) => { + await goplsInstall(goPath,controller) + .then(([results, code,signal]) => { installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await goOutLineInstall(goPath) - .then(([results, code]) => { - 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) => { console.error(error); + reject(error); }); resolve([installToolsMessage, codeProcess]) } catch (error) { - console.log("Go工具安裝失败:", error) + console.log("Go工具安裝失败:", error); + reject(error); } } @@ -266,131 +244,170 @@ function executableFileExists(filePath) { return exists; } //下载gopls@0.9.5 -function gopls095Install(goPath) { +function gopls095Install(goPath,controller) { 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.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); - ls.on('close', (code) => { + ls.on('close', (code,signal) => { console.log(`子进程退出码:${code}`); + controller.signal.removeEventListener('abort', cancelTask); if (code === 0) { console.log("gopls@v0.9.5安装成功"); - resolve(["gopls@v0.9.5安装成功", code]); + resolve(["gopls@v0.9.5安装成功", code,signal]); } else { 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 -function goplsInstall(goPath) { +function goplsInstall(goPath,controller) { 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.stderr.on('data', (data) => { console.error(`${data}`); }); - ls.on('close', (code) => { + ls.on('close', (code,signal) => { console.log(`子进程退出码:${code}`); + controller.signal.removeEventListener('abort', cancelTask); if (code === 0) { console.log("gopls安装成功"); - resolve(["gopls安装成功", code]); - } else { + resolve(["gopls安装成功", code,signal]); + }else { 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 -function dlv160Install(goPath) { +function dlv160Install(goPath,controller) { 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.stderr.on('data', (data) => { console.error(`${data}`); }); - ls.on('close', (code) => { + ls.on('close', (code,signal) => { console.log(`子进程退出码:${code}`); + controller.signal.removeEventListener('abort', cancelTask); if (code === 0) { console.log("dlv@v1.6.0安装成功"); - resolve(["dlv@v1.6.0安装成功", code]); + resolve(["dlv@v1.6.0安装成功", code,signal]); } else { 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 -function dlv161Install(goPath) { +function dlv161Install(goPath,controller) { 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.stderr.on('data', (data) => { console.error(`${data}`); }); - ls.on('close', (code) => { + ls.on('close', (code,signal) => { console.log(`子进程退出码:${code}`); + controller.signal.removeEventListener('abort', cancelTask); if (code === 0) { console.log("dlv@v1.6.1安装成功"); - resolve(["dlv@v1.6.1安装成功", code]) - } else { + resolve(["dlv@v1.6.1安装成功", code,signal]) + }else { 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 -function dlvInstall(goPath) { +function dlvInstall(goPath,controller) { 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.stderr.on('data', (data) => { console.error(`${data}`); }); - ls.on('close', (code) => { + ls.on('close', (code,signal) => { console.log(`子进程退出码:${code}`); + controller.signal.removeEventListener('abort', cancelTask); if (code === 0) { console.log("dlv安装成功"); - resolve(["dlv安装成功", code]) + resolve(["dlv安装成功", code,signal]) } else { 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 -function goOutLineInstall(goPath) { +function goOutLineInstall(goPath,controller) { 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.stderr.on('data', (data) => { console.error(`${data}`); }); - ls.on('close', (code) => { + ls.on('close', (code,signal) => { + controller.signal.removeEventListener('abort', cancelTask); console.log(`子进程退出码:${code}`); if (code === 0) { console.log("go-outline安装成功"); - resolve(["go-outline安装成功", code]) - } else { + resolve(["go-outline安装成功", code,signal]) + } else { 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路径以及版本号 @@ -453,7 +470,7 @@ function checkSystemType() { } -async function main() { +async function main(controller) { return new Promise((resolve, reject) => { let goVersion = ""; let goPath = ""; @@ -489,12 +506,14 @@ async function main() { }) p.then(async (value) => { if (goPath !== "") { - GoToolsInstall(archName, goVersion, goPath, systemtype) + GoToolsInstall(archName, goVersion, goPath, systemtype,controller) .then(([results, code]) => { resolve([results, code]) - }) + }).catch((error) => { + reject(error); + }); } else { - console.log("找不到go路径") + reject("找不到go路径") } @@ -502,7 +521,7 @@ async function main() { }) } -// main(); + module.exports = { main } diff --git a/installwizard/config/python3_config-0.0.1.sh b/installwizard/config/python3_config-0.0.2.sh similarity index 51% rename from installwizard/config/python3_config-0.0.1.sh rename to installwizard/config/python3_config-0.0.2.sh index bb463a07..6d372b8b 100644 --- a/installwizard/config/python3_config-0.0.1.sh +++ b/installwizard/config/python3_config-0.0.2.sh @@ -1,3 +1,3 @@ #!/bin/bash echo "exec \"pip3 install pylint -i https://pypi.tuna.tsinghua.edu.cn/simple\"" -pip3 install pylint -i https://pypi.tuna.tsinghua.edu.cn/simple \ No newline at end of file +pip3 install pylint -break-system-packages -i https://pypi.tuna.tsinghua.edu.cn/simple \ No newline at end of file