From 88d3ade64d05a2a83bec1024290999b00c95160f Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sat, 10 Jun 2023 18:05:13 -0700 Subject: [PATCH] Avoid background crash when fixing the tmux layout --- scripts/wk/ui/tmux.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/wk/ui/tmux.py b/scripts/wk/ui/tmux.py index c7ff193f..943b6aa4 100644 --- a/scripts/wk/ui/tmux.py +++ b/scripts/wk/ui/tmux.py @@ -129,7 +129,12 @@ def get_pane_size(pane_id: str | None = None) -> tuple[int, int]: # Get resolution proc = run_program(cmd, check=False) - width, height = proc.stdout.strip().split() + try: + width, height = proc.stdout.strip().split() + except ValueError: + # Assuming this is a race condition as it usually happens inside the + # background fix layout loop + return 0, 0 width = int(width) height = int(height)