From d35dda68fcb63b31be2871c558e7aa7c35c52623 Mon Sep 17 00:00:00 2001 From: "Brandon McGinty (deepseek)" Date: Tue, 18 Aug 2026 20:09:57 -0400 Subject: [PATCH] Fix dialog display for yesno and msgbox prompts --- barnard-ui | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/barnard-ui b/barnard-ui index 3762af8..da653d9 100755 --- a/barnard-ui +++ b/barnard-ui @@ -81,11 +81,18 @@ class ConfigError(Exception): DIALOG_OPTS = ["--insecure", "--no-lines", "--visit-items"] -def run_dialog(args, stdout=False): +def run_dialog(args, capture_result=False): + """Run dialog. + + dialog draws its widgets on stderr and writes the selected value on stdout + when --stdout is used. Keep stderr attached to the terminal for display and + only capture stdout when a result is needed. + """ cmd = ["dialog", "--clear"] + DIALOG_OPTS + args - if stdout: + if capture_result: cmd.append("--stdout") - return subprocess.run(cmd, capture_output=True, text=True) + return subprocess.run(cmd, stdout=subprocess.PIPE, stderr=None, text=True) + return subprocess.run(cmd) def msgbox(message): @@ -101,7 +108,8 @@ def yesno(question): question, "10", "80", - ] + ], + capture_result=False, ) return proc.returncode == 0 @@ -117,7 +125,7 @@ def inputbox(instructions, initial=""): "0", initial, ], - stdout=True, + capture_result=True, ) if proc.returncode != 0: return None @@ -135,7 +143,7 @@ def passwordbox(instructions, initial=""): "0", initial, ], - stdout=True, + capture_result=True, ) if proc.returncode != 0: return None @@ -161,7 +169,7 @@ def menulist(options): "0", ] + items, - stdout=True, + capture_result=True, ) if proc.returncode != 0: return None