4 Star 17 Fork 6

kuosoft/阔老板

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
guard.js 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
elikj 提交于 2021-11-11 16:29 . 细节优化
global.FS = require('fs');
global.xiancheng = {};
var exec = require('child_process').exec;
global.goshell = async function(appPath){
if(appPath && appPath != "" &&!xiancheng[appPath]){
var worker = exec(appPath);
xiancheng[appPath] = worker.pid ;
worker.on('messageerror',function(data){
});
worker.on('exit',function(data){
delete xiancheng[appPath];
setTimeout(function(){
var wenjian = null;
try {
wenjian = FS.readFileSync(__dirname+"/kuosoft.txt").toString();
} catch(e) {}
let $jiexi = wenjian.split("\n");
for(var x in $jiexi){
if(appPath == $jiexi[x]){
goshell(appPath);
break ;
}
}
},100);
});
}
}
function xiecheng(){
var wenjian = null;
try {
wenjian = FS.readFileSync(__dirname+"/kuosoft.txt").toString();
} catch(e) {}
if(wenjian){
let $jiexi = wenjian.split("\n");
for(var x in $jiexi){
goshell($jiexi[x]);
}
}
}
setInterval(xiecheng, 2000);
process.on('SIGINT', function () {
if(xiancheng){
for(var xx in xiancheng){
exec('kill -9 '+xiancheng[xx]);
}
}
process.exit();
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/13yd-osc/oldkuosoft.git
git@gitee.com:13yd-osc/oldkuosoft.git
13yd-osc
oldkuosoft
阔老板
master

搜索帮助