From 01e97daefc5867709e907b294e7fd7ec7a522a02 Mon Sep 17 00:00:00 2001 From: ollie Date: Sun, 19 Jul 2026 19:11:32 +0200 Subject: [PATCH] remote: parse port from user@host:port SSH target --- pkg/remote/remote.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/remote/remote.go b/pkg/remote/remote.go index bbf054c..712cc59 100644 --- a/pkg/remote/remote.go +++ b/pkg/remote/remote.go @@ -56,7 +56,16 @@ func Dial(ctx context.Context, cfg Config) (*Server, error) { remoteCmd += " --yolo" } - cmd := exec.CommandContext(ctx, "ssh", cfg.SSHTarget, remoteCmd) + // Parse optional port from SSHTarget (user@host:port or host:port) + sshArgs := []string{} + sshTarget := cfg.SSHTarget + if host, port, ok := strings.Cut(sshTarget, ":"); ok && port != "" { + sshTarget = host + sshArgs = append(sshArgs, "-p", port) + } + sshArgs = append(sshArgs, sshTarget, remoteCmd) + + cmd := exec.CommandContext(ctx, "ssh", sshArgs...) cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} stdin, err := cmd.StdinPipe()