From cc80a1ddf80f34f2ac68534b333ae23e6c5518c9 Mon Sep 17 00:00:00 2001 From: SpookyDervish <78246495+SpookyDervish@users.noreply.github.com> Date: Sun, 26 Oct 2025 15:29:27 +1100 Subject: [PATCH] fixed an issue where the entire app would crash if a command failed lol --- main.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index edafcdc..7111f98 100644 --- a/main.py +++ b/main.py @@ -45,6 +45,7 @@ class Berry(App): id="file-tabs" ) yield TextArea.code_editor(placeholder="This file is empty.", language="python", theme="css", id="code-editor", disabled=True) + with Vertical(id="console-container"): yield RichLog(id="console") yield Input(placeholder="> ", id="console-input") @@ -62,8 +63,18 @@ class Berry(App): console = self.query_one("#console") console.write(f"> {command}") - result = subprocess.check_output(command, shell=True, text=True) - console.write(result) + + if command == "clear" or command == "cls": + console.clear() + else: + try: + result = subprocess.check_output(command, shell=True, text=True) + console.write(result) + except subprocess.CalledProcessError as e: + console.write(e.stdout) + + + self.query_one("#console-input").focus() def action_find(self): try: @@ -177,6 +188,8 @@ class Berry(App): code_editor.language = None code_editor.disabled = False + code_editor.focus() + @on(Window.Minimized) def window_minimized(self, event: Window.Minimized):