From 3d222e32368e104a470901e6186784beaf40b219 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Sat, 16 Feb 2019 11:29:30 +0100 Subject: [PATCH] reimplement the run method on the backup class For some reason the BorgExceptions from the backup thread don't get caught in the main_window. Therefore I'm implementing the error handling directly in the class for the moment. This will have the side effect that the error dialog will pop up when there is a problem during a background backup. However that is anyway something I thought about implementing. This way it's just not properly implemented yet. --- borg_qt/borg_interface.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/borg_qt/borg_interface.py b/borg_qt/borg_interface.py index 34ccf9f..530944e 100644 --- a/borg_qt/borg_interface.py +++ b/borg_qt/borg_interface.py @@ -5,7 +5,7 @@ import json from PyQt5.QtCore import QThread -from helper import BorgException +from helper import BorgException, show_error class BorgQtThread(QThread): @@ -106,6 +106,15 @@ class BackupThread(BorgQtThread): if self.excludes: self.command.extend(self.excludes) + def run(self): + self.json_output, self.json_err = self.p.communicate() + self.p.wait() + try: + self.process_json_error(self.json_err) + except BorgException as e: + show_error(e) + self.stop() + def _process_prefix(self, prefix): """Prepares the prefix for the final command.""" if prefix: