|
@@ -1622,18 +1622,34 @@ static void sig_handle(int signo)
|
|
|
if (WIFEXITED(status)) {
|
|
if (WIFEXITED(status)) {
|
|
|
sprintf(szMsg, "child process %d terminated normal with exit code: %d", pid, WEXITSTATUS(status));
|
|
sprintf(szMsg, "child process %d terminated normal with exit code: %d", pid, WEXITSTATUS(status));
|
|
|
} else {
|
|
} else {
|
|
|
- sprintf(szMsg, "child process %d has been terminated unexpectly by signal %d", pid, WTERMSIG(status));
|
|
|
|
|
|
|
+ const int signum = WTERMSIG(status);
|
|
|
|
|
+ sprintf(szMsg, "child process %d has been terminated unexpectly by signal %d", pid, signum);
|
|
|
|
|
+ //if(signum != SIGKILL)
|
|
|
excep = true;
|
|
excep = true;
|
|
|
}
|
|
}
|
|
|
LogSingleMsg(szMsg);
|
|
LogSingleMsg(szMsg);
|
|
|
if (g_SpShellPID != 0 && g_SpShellPID == pid) {
|
|
if (g_SpShellPID != 0 && g_SpShellPID == pid) {
|
|
|
LogSingleMsg("Specified spshell process has exited!");
|
|
LogSingleMsg("Specified spshell process has exited!");
|
|
|
g_SpShellPID = 0;
|
|
g_SpShellPID = 0;
|
|
|
- //if (excep) {
|
|
|
|
|
- // LogSingleMsg("Confirm other relate process has been terminated.");
|
|
|
|
|
- // char* processes[] = { sphost_execute_name, cefclient_execute_name };
|
|
|
|
|
- // osutil_terminate_related_process(processes, array_size(processes));
|
|
|
|
|
- //}
|
|
|
|
|
|
|
+ if (excep) {
|
|
|
|
|
+ LogSingleMsg("Confirm other relate process has been terminated.");
|
|
|
|
|
+ int count = 60;
|
|
|
|
|
+ alive_process_info processes[60];
|
|
|
|
|
+ memset(processes, 0, sizeof(processes));
|
|
|
|
|
+ if (!osutil_detect_unique_app(relate_processes_ex, array_size(relate_processes_ex), &count, processes)) {
|
|
|
|
|
+ bool spshell_exist(false);
|
|
|
|
|
+ for (int i = 0; i < count; ++i) {
|
|
|
|
|
+ if (strcmp(processes[i].name, spshell_execute_name) == 0) {
|
|
|
|
|
+ spshell_exist = true;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ for (int i = 0; !spshell_exist && i < count; ++i) {
|
|
|
|
|
+ kill(processes[i].pid, SIGKILL);
|
|
|
|
|
+ LogToFile(true, true, true, "kill", processes[i].name, processes[i].pid, errno);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|