(self)
| 120 | return EMPTY_PROCESS_LOGGER |
| 121 | |
| 122 | def execute(self): |
| 123 | if self.verbose: |
| 124 | print('# %s' % self) |
| 125 | |
| 126 | process = self._start_process() |
| 127 | |
| 128 | with handle_sigterm(process, self._abort, self.handle_sigterm): |
| 129 | # Variable to communicate with the timer. |
| 130 | timeout_occured = [False] |
| 131 | timer = threading.Timer( |
| 132 | self.timeout, self._abort, [process, timeout_occured]) |
| 133 | timer.start() |
| 134 | |
| 135 | start_time = time.time() |
| 136 | with self.log_errors(): |
| 137 | with self.process_logger.log_stats(process) as stats: |
| 138 | stdout, stderr = process.communicate() |
| 139 | end_time = time.time() |
| 140 | |
| 141 | timer.cancel() |
| 142 | |
| 143 | self._result_overrides(process) |
| 144 | return output.Output( |
| 145 | process.returncode, |
| 146 | timeout_occured[0], |
| 147 | stdout.decode('utf-8', 'replace'), |
| 148 | stderr.decode('utf-8', 'replace'), |
| 149 | process.pid, |
| 150 | start_time, |
| 151 | end_time, |
| 152 | stats=stats, |
| 153 | ) |
| 154 | |
| 155 | def _start_process(self): |
| 156 | with self.log_errors(): |
no test coverage detected