Skip to content

Commit

Permalink
fix: return the error in case of SSH connection error (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
pggb25 authored Dec 2, 2024
1 parent 3f345e0 commit 6be5cf1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cmd/admin_k9s.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,16 @@ func setupSSHConnection(ctx context.Context) (*exec.Cmd, error) {
}

if err := waitForSSHConnection(ctx, "localhost:1080", 30*time.Second); err != nil {
err := sshCmd.Process.Kill()
if err != nil {
return nil, err
if killErr := sshCmd.Process.Kill(); killErr != nil {
log.Errorf("failed to kill SSH process: %v", killErr)
}
return nil, fmt.Errorf("error waiting for SSH connection: %v", err)
}

log.Info("SSH connection established successfully")
if err := os.Setenv("HTTPS_PROXY", "socks5://localhost:1080"); err != nil {
err := sshCmd.Process.Kill()
if err != nil {
return nil, err
if killErr := sshCmd.Process.Kill(); killErr != nil {
log.Errorf("failed to kill SSH process: %v", killErr)
}
return nil, fmt.Errorf("failed to set HTTPS_PROXY: %v", err)
}
Expand Down

0 comments on commit 6be5cf1

Please sign in to comment.