| 64 | self._command = resolved |
| 65 | |
| 66 | def run(self) -> None: |
| 67 | start = datetime.now() |
| 68 | try: |
| 69 | if self._fn is not None: |
| 70 | self.success, self.output = self._fn() |
| 71 | else: |
| 72 | assert self._command is not None |
| 73 | proc = subprocess.Popen( |
| 74 | self._command, |
| 75 | stdout=subprocess.PIPE, |
| 76 | stderr=subprocess.STDOUT, |
| 77 | ) |
| 78 | stdout, _ = proc.communicate() |
| 79 | self.success = proc.returncode == 0 |
| 80 | self.output = stdout.decode("utf-8").strip() |
| 81 | except Exception as e: |
| 82 | self.output = str(e) |
| 83 | self.success = False |
| 84 | self.duration = datetime.now() - start |
| 85 | if self._done_queue is not None: |
| 86 | self._done_queue.put(self) |
| 87 | |
| 88 | |
| 89 | class _SpinnerThread(threading.Thread): |