Kills a process currently being debugged. @see: L{detach} @type dwProcessId: int @param dwProcessId: Global ID of a process to kill. @type bIgnoreExceptions: bool @param bIgnoreExceptions: C{True} to ignore any exceptions that may be
(self, dwProcessId, bIgnoreExceptions=False)
| 654 | warnings.warn(str(e), RuntimeWarning) |
| 655 | |
| 656 | def kill(self, dwProcessId, bIgnoreExceptions=False): |
| 657 | """ |
| 658 | Kills a process currently being debugged. |
| 659 | |
| 660 | @see: L{detach} |
| 661 | |
| 662 | @type dwProcessId: int |
| 663 | @param dwProcessId: Global ID of a process to kill. |
| 664 | |
| 665 | @type bIgnoreExceptions: bool |
| 666 | @param bIgnoreExceptions: C{True} to ignore any exceptions that may be |
| 667 | raised when killing the process. |
| 668 | |
| 669 | @raise WindowsError: Raises an exception on error, unless |
| 670 | C{bIgnoreExceptions} is C{True}. |
| 671 | """ |
| 672 | |
| 673 | # Keep a reference to the process. We'll need it later. |
| 674 | try: |
| 675 | aProcess = self.system.get_process(dwProcessId) |
| 676 | except KeyError: |
| 677 | aProcess = Process(dwProcessId) |
| 678 | |
| 679 | # Cleanup all data referring to the process. |
| 680 | self.__cleanup_process(dwProcessId, bIgnoreExceptions=bIgnoreExceptions) |
| 681 | |
| 682 | # Kill the process. |
| 683 | try: |
| 684 | try: |
| 685 | if self.is_debugee(dwProcessId): |
| 686 | try: |
| 687 | if aProcess.is_alive(): |
| 688 | aProcess.suspend() |
| 689 | finally: |
| 690 | self.detach(dwProcessId, bIgnoreExceptions=bIgnoreExceptions) |
| 691 | finally: |
| 692 | aProcess.kill() |
| 693 | except Exception: |
| 694 | if not bIgnoreExceptions: |
| 695 | raise |
| 696 | e = sys.exc_info()[1] |
| 697 | warnings.warn(str(e), RuntimeWarning) |
| 698 | |
| 699 | # Cleanup what remains of the process data. |
| 700 | try: |
| 701 | aProcess.clear() |
| 702 | except Exception: |
| 703 | if not bIgnoreExceptions: |
| 704 | raise |
| 705 | e = sys.exc_info()[1] |
| 706 | warnings.warn(str(e), RuntimeWarning) |
| 707 | |
| 708 | def kill_all(self, bIgnoreExceptions=False): |
| 709 | """ |