This commit is contained in:
Namhyeon Go 2020-11-27 22:31:51 +09:00
parent 187adf9b34
commit 3fb0613444
2 changed files with 92 additions and 78 deletions

View File

@ -125,6 +125,14 @@ exports.getPIDList = function() {
return result;
};
exports.isAlivePID = function(pid) {
if (!pid) {
return false;
} else {
return (exports.getPIDList().indexOf(pid) > -1);
}
};
exports.getProcessListByName = function(name) {
return exports.getProcessList().filter(function(s) {
return (s.Caption === name);

View File

@ -57,16 +57,18 @@ var check_LDPlayer = function() {
AppsMutex.push(pid);
if (title in Apps.LDPlayer) {
while (!SYS.isAlivePID(ssPID)) {
var ss = SS.connect(Apps.LDPlayer[title]);
ssPort = ss.listenPort;
ssPID = ss.processID;
}
} else {
console.error("Not assigned static IP: " + title);
continue;
}
var process;
while (!(shadowPID > 0)) {
while (!SYS.isAlivePID(shadowPID)) {
process = SHELL.createProcess([
SYS.getCurrentScriptDirectory() + "/bin/shadow.exe",
"-c",
@ -76,7 +78,7 @@ var check_LDPlayer = function() {
"-p",
pid
]);
sleep(1000);
sleep(3000);
shadowPID = process.ProcessID;
}
@ -102,16 +104,18 @@ var check_NoxPlayer = function() {
AppsMutex.push(pid);
if (hostname in Apps.NoxPlayer) {
while (!SYS.isAlivePID(ssPID)) {
var ss = SS.connect(Apps.NoxPlayer[hostname]);
ssPort = ss.listenPort;
ssPID = ss.processID;
}
} else {
console.error("Not assigned static IP: " + hostname);
continue;
}
var process;
while (!(shadowPID > 0)) {
while (!SYS.isAlivePID(shadowPID)) {
process = SHELL.createProcess([
SYS.getCurrentScriptDirectory() + "/bin/shadow.exe",
"-c",
@ -121,7 +125,7 @@ var check_NoxPlayer = function() {
"-p",
pid
]);
sleep(1000);
sleep(3000);
shadowPID = process.ProcessID;
}
@ -156,13 +160,15 @@ var check_ProcessName = function() {
AppsMutex.push("processName_" + uniqueId);
// 소켓 연결
while (!SYS.isAlivePID(ssPID)) {
var ss = SS.connect(Apps.ProcessName[uniqueId]);
ssPort = ss.listenPort;
ssPID = ss.processID;
}
// 프로세스 이름으로 실행
var process;
while (!(shadowPID > 0)) {
while (!SYS.isAlivePID(shadowPID)) {
process = SHELL.createProcess([
SYS.getCurrentScriptDirectory() + "/bin/shadow.exe",
"-c",
@ -172,7 +178,7 @@ var check_ProcessName = function() {
"-n",
uniqueId
]);
sleep(1000);
sleep(3000);
shadowPID = process.ProcessID;
}