From 8ab5a13cca0e55426ec16c610776ff223442d321 Mon Sep 17 00:00:00 2001 From: zlax Date: Fri, 5 Apr 2024 14:28:53 +0300 Subject: [PATCH] exception handling when a session subprocess is interrupted (f.e. ctr+c on password entry) --- setup.py | 2 +- sshch/sshch | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index d80ab0b..ddc6bf2 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def main(): long_description='SSH connection and aliases manager with curses and command line interface', long_description_content_type='text/x-rst', license='DWTWL 2.55', - version='1.09.6', + version='1.09.7', py_modules=['sshch'], scripts=['sshch/sshch'], keywords='sshch ssh aliases curses manager', diff --git a/sshch/sshch b/sshch/sshch index bd49390..5c27085 100755 --- a/sshch/sshch +++ b/sshch/sshch @@ -22,7 +22,7 @@ from curses import textpad, panel from threading import Thread # https://gitlab.com/zlax/sshch -version = "1.09.6" +version = "1.09.7" # expand groups by default expand_default = True # path to conf dir and file, default: ~/.config/sshch.conf @@ -138,7 +138,10 @@ def ConnectAlias(alias, command=False, threading=False): exec_string = exec_string + conf.get(alias, "exec_string") if command: exec_string = exec_string + " " + command - subprocess.Popen(exec_string, shell=True).communicate()[0] + try: + subprocess.Popen(exec_string, shell=True).communicate()[0] + except: + pass if threading: print ("... "+alias+" session output finished.")