From e4fbcd6825c93b09d530cf1c652e35845e58ea02 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sun, 24 Sep 2023 15:04:36 -0400 Subject: [PATCH] Added an error for when the configured text editor cannot be found on the system Former-commit-id: f41356854b88cf6a53604ef37025667d17041da7 Former-commit-id: 627cb9298583b7fbb6358edead75c65e671619d0 --- lib/sshyp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/sshyp.py b/lib/sshyp.py index f3f097f..3774e9c 100755 --- a/lib/sshyp.py +++ b/lib/sshyp.py @@ -123,7 +123,10 @@ def edit_note(_note_lines, _exit_on_match=False): with NamedTemporaryFile(mode='w+') as _tmp: _tmp.write(_joined_note_lines) _tmp.seek(0) - run((editor, _tmp.name)) + try: + run((editor, _tmp.name)) + except FileNotFoundError: + print(f"\n\u001b[38;5;9merror: the configured text editor ({editor}) cannot be found on this system\n\nplease either install the editor or re-configure the active editor using 'sshyp tweak'\u001b[0m\n") _tmp.seek(0) _new_note = _tmp.read().rstrip() if _exit_on_match and _joined_note_lines == _new_note: @@ -717,7 +720,7 @@ if __name__ == "__main__": sync('\n') elif offline_mode_enabled == 'true': print("\n\u001b[38;5;9mwarning: sshyp is currently configured in offline mode - ssh synchronization is " - "disabled\n") + "disabled\u001b[0m\n") # PORT START ARGS-SERVER # server arguments