(self, file_name)
| 22 | self.child_pid = None |
| 23 | |
| 24 | def show(self, file_name): |
| 25 | shell_process = subprocess.Popen(f'{file_name}', shell=True) |
| 26 | parent = psutil.Process(shell_process.pid) |
| 27 | for _ in range(999): |
| 28 | children = parent.children(recursive=True) |
| 29 | if children: |
| 30 | break |
| 31 | time.sleep(0.1) |
| 32 | self.child_pid = children[0].pid |
| 33 | |
| 34 | def close(self): |
| 35 | subprocess.check_output(f"Taskkill /PID {self.child_pid} /F") |