Terminate the background process.
(self)
| 94 | self.status = "running" |
| 95 | |
| 96 | async def terminate(self): |
| 97 | """Terminate the background process.""" |
| 98 | if self.process.returncode is None: |
| 99 | self.process.terminate() |
| 100 | try: |
| 101 | await asyncio.wait_for(self.process.wait(), timeout=5) |
| 102 | except asyncio.TimeoutError: |
| 103 | self.process.kill() |
| 104 | self.status = "terminated" |
| 105 | self.exit_code = self.process.returncode |
| 106 | |
| 107 | |
| 108 | class BackgroundShellManager: |