commit 3b5ef40b112909d4b98241f961c4f16eaf0f7f83 parent 2443987663f7272d8e7a2b4cf2ad4f2898875739 Author: nickfarrow <nick@nickfarrow.com> Date: Mon, 21 Mar 2022 00:13:35 +1100 dont break when closing nonexistent processes Diffstat:
M | gateways/ssh_tunnel.py | | | 20 | +++++++++++--------- |
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/gateways/ssh_tunnel.py b/gateways/ssh_tunnel.py @@ -60,14 +60,15 @@ def rm_lightning_rpc_file(): return def close_tunnels(ssh_processes): - for proc in ssh_processes: - try: - proc.kill() - except Exception as e: - continue - - if config.clightning_rpc_file is not None: - rm_lightning_rpc_file() + if ssh_processes is not None: + for proc in ssh_processes: + try: + proc.kill() + except Exception as e: + continue + + if config.clightning_rpc_file is not None: + rm_lightning_rpc_file() return @@ -86,4 +87,4 @@ def open_tunnels(): if config.clightning_rpc_file is not None: ssh_tunnel_processes.append(clightning_unix_domain_socket_ssh()) - return [proc for proc in ssh_tunnel_processes if proc is not None] + return [proc for proc in ssh_tunnel_processes if proc is not None] +\ No newline at end of file