Files
ssh-netbox-wrapper/internal/ssh/exec.go
T
Sebastian Unterschütz 8ef4bbec16
Release / release (push) Failing after 51s
Add core modules (SSH args parser, cache, resolver, NetBox client) with tests
2026-05-23 12:38:41 +02:00

20 lines
452 B
Go

package ssh
import (
"fmt"
"os"
"os/exec"
"syscall"
)
// Exec replaces the current process with the native ssh client via syscall.Exec.
// All existing SSH configs, keys, and agent forwarding remain intact.
func Exec(args []string) error {
sshPath, err := exec.LookPath("ssh")
if err != nil {
return fmt.Errorf("ssh not found in PATH: %w", err)
}
argv := append([]string{"ssh"}, args...)
return syscall.Exec(sshPath, argv, os.Environ())
}