//go:build !windows

package connect

import (
	"os"
	"os/exec"
	"syscall"
)

// execCommand replaces the current process with the target binary via execve.
// This is what makes ssh's tty/ProxyJump/agent-forwarding "just work": dial is
// gone, and ssh owns the terminal directly with no wrapping parent.
func execCommand(c Command) error {
	path, err := exec.LookPath(c.Bin)
	if err != nil {
		return err
	}
	argv := append([]string{c.Bin}, c.Args...)
	return syscall.Exec(path, argv, os.Environ())
}
