增加杀死进程的操作
This commit is contained in:
@@ -21,6 +21,14 @@ class Process {
|
||||
resolve()
|
||||
} else reject(err)
|
||||
})
|
||||
this.pid.on('exit', (code, err) => {
|
||||
if (code == 0 && !err) {
|
||||
resolve()
|
||||
} else reject(err)
|
||||
})
|
||||
this.pid.stdout.on('data', data => {
|
||||
console.log(data)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ const execute = require("../../tools/exec")
|
||||
const process = require("../../tools/childProcess")
|
||||
const dayjs = require("dayjs")
|
||||
const fse = require("fs-extra");
|
||||
|
||||
let pid
|
||||
const handleZip = (id, ws) => {
|
||||
const uniCon = `id='${id}'`
|
||||
const sendMessage = data => ws.send(JSON.stringify(data))
|
||||
@@ -15,7 +15,7 @@ const handleZip = (id, ws) => {
|
||||
wxwork: 'base-wxcp',
|
||||
mp: 'dvcp_v2_wxmp'
|
||||
}[info.type] || {}
|
||||
let path = `../${buildPath}`, {dist} = info, pid
|
||||
let path = `../${buildPath}`, {dist} = info
|
||||
dist = dist || `../zips/${info.name}v${info.version || "1.0.0"}`
|
||||
Promise.all([
|
||||
db.query(`update node_custom_config set download=null,error=null,zipTime='${dayjs().format("YYYY-MM-DD HH:mm:ss")}' where ${uniCon}`),
|
||||
@@ -52,8 +52,11 @@ module.exports = {
|
||||
if (res?.data) {
|
||||
const data = JSON.parse(res.data)
|
||||
if (data.cid == id) {
|
||||
|
||||
} else if (id == data.id) handleZip(id, ws)
|
||||
pid.kill()
|
||||
} else if (id == data.id) {
|
||||
pid.kill()
|
||||
handleZip(id, ws)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user