(self)
| 196 | return None |
| 197 | |
| 198 | def get_pid_by_env_key(self) -> Optional[int]: |
| 199 | env_key = "BT_PYTHON_SERVICE_SID={}".format(self.sid) |
| 200 | target = [] |
| 201 | for p in psutil.pids(): |
| 202 | try: |
| 203 | data: str = public.readFile("/proc/{}/environ".format(p)) |
| 204 | if data.rfind(env_key) != -1: |
| 205 | target.append(p) |
| 206 | except: |
| 207 | continue |
| 208 | |
| 209 | for i in target: |
| 210 | try: |
| 211 | p = psutil.Process(i) |
| 212 | if p.ppid() not in target: |
| 213 | return i |
| 214 | except: |
| 215 | continue |
| 216 | return None |
| 217 | |
| 218 | def get_pid_by_command(self) -> Optional[int]: |
| 219 | cmd_list = self.split_command() |
no test coverage detected