A `crewai run` that create started. Ctrl-C interrupts create's wait for it ``interrupts`` times, then the run ends with ``returncode``.
| 412 | |
| 413 | |
| 414 | class _StartedRun: |
| 415 | """A `crewai run` that create started. Ctrl-C interrupts create's wait for it |
| 416 | ``interrupts`` times, then the run ends with ``returncode``.""" |
| 417 | |
| 418 | def __init__(self, args, kwargs, returncode: int, interrupts: int) -> None: |
| 419 | self.args = args |
| 420 | self.cwd = kwargs.get("cwd") |
| 421 | self.env = kwargs.get("env") |
| 422 | self.killed = False |
| 423 | self._returncode = returncode |
| 424 | self._interrupts = interrupts |
| 425 | |
| 426 | def wait(self) -> int: |
| 427 | if self._interrupts: |
| 428 | self._interrupts -= 1 |
| 429 | raise KeyboardInterrupt |
| 430 | return self._returncode |
| 431 | |
| 432 | def kill(self) -> None: |
| 433 | self.killed = True |
| 434 | |
| 435 | terminate = kill |
| 436 | |
| 437 | |
| 438 | def _record_runs( |