poll(block = False) -> int Arguments: block(bool): Wait for the process to exit Poll the exit code of the process. Will return None, if the process has not yet finished and the exit code otherwise.
(self, block = False)
| 666 | self.close() |
| 667 | |
| 668 | def poll(self, block = False): |
| 669 | """poll(block = False) -> int |
| 670 | |
| 671 | Arguments: |
| 672 | block(bool): Wait for the process to exit |
| 673 | |
| 674 | Poll the exit code of the process. Will return None, if the |
| 675 | process has not yet finished and the exit code otherwise. |
| 676 | """ |
| 677 | |
| 678 | # In order to facilitate retrieving core files, force an update |
| 679 | # to the current working directory |
| 680 | _ = self.cwd |
| 681 | |
| 682 | if block: |
| 683 | self.wait_for_close() |
| 684 | |
| 685 | self.proc.poll() |
| 686 | returncode = self.proc.returncode |
| 687 | |
| 688 | if returncode is not None and not self._stop_noticed: |
| 689 | self._stop_noticed = time.time() |
| 690 | signame = '' |
| 691 | if returncode < 0: |
| 692 | signame = ' (%s)' % (signal_names.get(returncode, 'SIG???')) |
| 693 | |
| 694 | self.info("Process %r stopped with exit code %d%s (pid %i)" % (self.display, |
| 695 | returncode, |
| 696 | signame, |
| 697 | self.pid)) |
| 698 | return returncode |
| 699 | |
| 700 | def communicate(self, stdin = None): |
| 701 | """communicate(stdin = None) -> str |