(p)
| 76 | |
| 77 | |
| 78 | def clean_process(p): |
| 79 | if getattr(p, 'exitcode', None) is None and getattr(p, 'returncode', None) is None: |
| 80 | # ask nicely (to try and catch the children) |
| 81 | try: |
| 82 | p.terminate() # SIGTERM |
| 83 | except OSError: |
| 84 | pass |
| 85 | time.sleep(1) |
| 86 | # send a forcible kill immediately afterwards. If the process did not die before, this should clean it. |
| 87 | try: |
| 88 | p.terminate() # SIGKILL |
| 89 | except OSError: |
| 90 | pass |
| 91 | |
| 92 | |
| 93 | class WebsockifyServerHarness: |