(self)
| 797 | return self.proc.stdout and not self.proc.stdout.closed |
| 798 | |
| 799 | def close(self): |
| 800 | if self.proc is None: |
| 801 | return |
| 802 | |
| 803 | # First check if we are already dead |
| 804 | self.poll() |
| 805 | |
| 806 | if not self._stop_noticed: |
| 807 | try: |
| 808 | self.proc.kill() |
| 809 | self.proc.wait() |
| 810 | self._stop_noticed = time.time() |
| 811 | self.info('Stopped process %r (pid %i)' % (self.program, self.pid)) |
| 812 | except OSError: |
| 813 | pass |
| 814 | |
| 815 | # close file descriptors |
| 816 | for fd in [self.proc.stdin, self.proc.stdout, self.proc.stderr]: |
| 817 | if fd is not None: |
| 818 | try: |
| 819 | fd.close() |
| 820 | except IOError as e: |
| 821 | if e.errno != errno.EPIPE and e.errno != errno.EINVAL: |
| 822 | raise |
| 823 | |
| 824 | |
| 825 | def fileno(self): |
no test coverage detected