(self)
| 631 | return "停止指令已执行" |
| 632 | |
| 633 | def other_service_pids(self) -> Set[int]: |
| 634 | res_pid = [] |
| 635 | for i in self.other_services: |
| 636 | service = self._build_service_by_conf(i) |
| 637 | if isinstance(service, str): |
| 638 | continue |
| 639 | pid = service.get_service_pid() |
| 640 | if isinstance(pid, int) and pid > 0 and psutil.pid_exists(pid): |
| 641 | res_pid.append(pid) |
| 642 | |
| 643 | sub_pid = [] |
| 644 | |
| 645 | def get_sub_pid(pro: psutil.Process) -> List[int]: |
| 646 | tmp_res = [] |
| 647 | if pro.status() != psutil.STATUS_ZOMBIE and pro.children(): |
| 648 | for sub_pro in pro.children(): |
| 649 | tmp_res.append(sub_pro.pid) |
| 650 | tmp_res.extend(get_sub_pid(sub_pro)) |
| 651 | return tmp_res |
| 652 | |
| 653 | for i in res_pid: |
| 654 | try: |
| 655 | p = psutil.Process(i) |
| 656 | sub_pid.extend(get_sub_pid(p)) |
| 657 | except: |
| 658 | pass |
| 659 | |
| 660 | return set(res_pid + sub_pid) |
| 661 | |
| 662 | |
| 663 | class main: |
no test coverage detected