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