electron launcher
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

20 lines
437 B

const { spawn } = require('child_process')
let pidMap = {}
function start(command, args) {
const childProgress = spawn(command, args)
pidMap[childProgress.pid] = childProgress
return childProgress.pid
}
function kill(pid) {
const childProgress = pidMap[pid]
if (!childProgress || childProgress.killed) return;
// TODO 需要测试是否能真正杀掉
return childProgress.kill()
}
module.exports = {
start,
kill,
}