From 0162b737c84d42e168803e0c074103b5c0676384 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sun, 12 Jan 2025 21:16:21 -0500 Subject: [PATCH] Fix crash for SSH dialing errors on interactive clients --- sync/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sync/client.go b/sync/client.go index 42990b5..e959bd4 100644 --- a/sync/client.go +++ b/sync/client.go @@ -101,6 +101,7 @@ func GetSSHClient(manualSync bool) (*ssh.Client, string, bool) { if err != nil { fmt.Println(core.AnsiError+"Sync failed - Unable to connect to remote server:", err.Error()+core.AnsiReset) core.Exit(core.ErrorServerConnection) // do not close/crash interactive clients + return nil, "", false } return sshClient, entryRoot, isWindows @@ -447,6 +448,9 @@ func folderSync(folders []string) { func RunJob(manualSync, returnLists bool) [3][]string { // get SSH client to re-use throughout the sync process sshClient, sshEntryRoot, sshIsWindows := GetSSHClient(manualSync) + if sshClient == nil { // indicate SSH dialing failure for interactive clients + return [3][]string{nil, nil, nil} + } defer func(sshClient *ssh.Client) { err := sshClient.Close() if err != nil {