(self)
| 62 | self.process.wait() |
| 63 | |
| 64 | def pipe_process_output(self): |
| 65 | try: |
| 66 | while True: |
| 67 | finished = False |
| 68 | wait_new_output = False |
| 69 | |
| 70 | if self.is_finished(): |
| 71 | data = self.process.stdout.read() |
| 72 | |
| 73 | finished = True |
| 74 | |
| 75 | else: |
| 76 | data = self.process.stdout.read(1) |
| 77 | |
| 78 | if not data: |
| 79 | wait_new_output = True |
| 80 | |
| 81 | if data: |
| 82 | output_text = data |
| 83 | self._write_script_output(output_text) |
| 84 | |
| 85 | if finished: |
| 86 | break |
| 87 | |
| 88 | if wait_new_output: |
| 89 | time.sleep(0.01) |
| 90 | |
| 91 | except: |
| 92 | self._write_script_output("Unexpected error occurred. Contact the administrator.") |
| 93 | |
| 94 | try: |
| 95 | self.kill() |
| 96 | except: |
| 97 | LOGGER.exception('Failed to kill a process') |
| 98 | |
| 99 | LOGGER.exception('Failed to read script output') |
| 100 | |
| 101 | finally: |
| 102 | self.output_stream.close() |
| 103 | self.process.stdout.close() |
| 104 | self.process.stdin.close() |
nothing calls this directly
no test coverage detected