Don't continously output errors if no dockers in ps
This commit is contained in:
parent
d44d605ff1
commit
5629b5823f
3
main.py
3
main.py
@ -327,6 +327,7 @@ class DockerGUI(QMainWindow):
|
|||||||
self.containers_tree.clear()
|
self.containers_tree.clear()
|
||||||
try:
|
try:
|
||||||
output = subprocess.check_output(["docker", "ps", "-a", "--format", "{{.ID}}\\t{{.Names}}\\t{{.Image}}\\t{{.Status}}\\t{{.Ports}}"], stderr=subprocess.STDOUT)
|
output = subprocess.check_output(["docker", "ps", "-a", "--format", "{{.ID}}\\t{{.Names}}\\t{{.Image}}\\t{{.Status}}\\t{{.Ports}}"], stderr=subprocess.STDOUT)
|
||||||
|
if output.strip():
|
||||||
containers = output.decode().strip().split("\n")
|
containers = output.decode().strip().split("\n")
|
||||||
for container in containers:
|
for container in containers:
|
||||||
parts = container.split("\t")
|
parts = container.split("\t")
|
||||||
@ -339,6 +340,8 @@ class DockerGUI(QMainWindow):
|
|||||||
self.restore_selection(self.containers_tree, selected_items)
|
self.restore_selection(self.containers_tree, selected_items)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"Error refreshing containers: {e.output.decode()}")
|
print(f"Error refreshing containers: {e.output.decode()}")
|
||||||
|
except ValueError as e:
|
||||||
|
print(f"Error parsing container list {repr(containers)}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Unexpected error refreshing containers: {str(e)}")
|
print(f"Unexpected error refreshing containers: {str(e)}")
|
||||||
QTimer.singleShot(0, lambda: self.containers_tree.verticalScrollBar().setValue(scroll_position))
|
QTimer.singleShot(0, lambda: self.containers_tree.verticalScrollBar().setValue(scroll_position))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user